How To Learn Python Step By Step
What is Python, how to download and how to install, what is Pycharm and how to install, Python Hello World how to write and python comment lines want to learn how to use it?
Python is an open source, easy-to-learn, free and high-level programming language developed by Guido Van Rossum in the early 1990s.
Python is an easy language to learn. Syntax is simple and simple. Like other languages, the program can be developed quickly without the need for assembly. It’s independent of platforms. This means that you can run the program that you type on all operating systems with minor changes.
Web and interface development, network socket programming, spider-type software, artificial intelligence, machine learning, hacking tools, game development, numerical and scientific calculations, data mining, analysis applications, and desktop applications can be implemented by developing software in many other areas.
With Python, large organizations such as Google, NASA, Wikipedia, Yahoo, CERN and Dropbox have made improvements. For example, Google web browsing spiders are written in Python. Python is also the most preferred software language in many areas, including combating cybercrime, infiltration testing, reverse engineering and hacking tools.
We need an IDE to write and test our Python setup package and codes. We will do software development with Python on the Windows 10 Operating System. But you may be using a Linux Operating System or a Mac Operating System. Don’t worry, the method we’re going to use soon applies to all operating systems.
1. First of all, we visit the official website of Python Python.org. We’re switching to the Downloads page by clicking on the Downloads button. Here you can start the download for the latest version of Python based on your operating system. We are starting the download process for Windows with the Download Python button.
2. After the download is finished, we open our Python setup file. The first incoming setup window has another user account on your computer, and if it is to use Python, you’ll need to go to Customize Installation and set another location for Python setup. Windows users also activate the Add Python PATH option to add python to the environment variables of the directory to which it is installed. This allows you to run Python codes without going to the directory where Python is installed with Windows Command Prompt.
3. We are starting the installation with install now option.
4. We remove the previously defined 260 character limit on your computer with the Disable Path Length Limit option so that Python can run smoothly in the last window of Python setup.
5. We complete the Python setup process with the Close button.
There’s no need to break tradition. The first application written when learning each software language is to print “Hello World” Hello World to the screen.
Let’s first write the Python Hello World app with Windows Command Prompt. By opening the Start menu, we type cmd and press enter. In the Windows Command Prompt tool, we press enter by typing python. That’s how we switch to python development. As a code, we write this. When we press print (“Hello World”) and enter from the keyboard, we see hello world output on the screen.
Second, let’s write the Python Hello World app with the Python IDLE tool. By opening the Start menu, we type idle and press enter, and we are greeted by the Python code development tool. Here’s what we write as code. Print(“Hello World”) and enter from the keyboard, we see hello world output on the Python Shell screen.
Our computer is ready to develop applications with python software language. But we have to have an app at our disposal so that we can diagnose, color our Python codes, show suggestions, find our mistakes, test them, and organize all our work files. In fact, this application should provide us with a working environment on the same project as our colleagues in different locations. These applications, which contain many features, can develop software quickly and seamlessly, called IDE programs. The IDE expansion can be done as an Integrated Development Environment. Python has written many IDE programs. We will develop your Python software with Pycharm IDE in our lessons.
Pycharm is a powerful and easy-to-use IDE program that enables us to develop fast applications with Python software language that can work on Linux distributions, Mac Operating Systems, and Windows Operating Systems such as Ubuntu.
To download the Pycharm IDE program, we visit the Pycharm subpage on the Official Website of JetBrains. https://www.jetbrains.com/pycharm/ download button.
After determining our choice according to our operating system, we see on this page that there are two different options called Pycharm Professional and Pycharm Community. I’d like to add an option when there are two options here. Pycharm Edu. Pycharm Professional comes with paid and many development plug-ins. Pycharm Community is completely free but lighter and simpler. As our trainings progress at the introduction and basic level, we will proceed with the Pycharm Community option. What about Pycharm Edu? Pycharm Edu is a free and open source tool that provides a powerful learning environment developed by focusing more on teacher and student relationships. If you previously installed Pycharm Professional or Pycharm Community on your computer, it is worth knowing that you have the chance to use it only by downloading the Pycharm EDU tool.
1. We are now starting pycharm download by clicking on the Download button under Pycharm Community option.
2. After pycharm download is complete, we open our downloaded file to start the Pycharm setup process. We’re moving forward with the next button.
3.We switch to the next window again using the Next button without changing the directory to which the program will be set up.
4. In the incoming setup options window, we can create a 32-bit or 64-bit Pycharm shortcut for the desktop with the options under the Create Desktop Shortcut tab. Pycharm setup is automatically installed as both 32 bits and 64 bits. With the option here, we only determine which version to create a shortcut for the desktop. We’re selecting the 64-bit option. If you lose the shortcut, you should know that you always have a chance to access pycharm 32-bit and Pycharm 64-bit versions under the C:\Program Files\JetBrains\PyCharm Community Edition xxx\bin folder.
By selecting Add launchers dir to the PATH under the Update PATH variable tab, we allow the Pycharm-installed directory to be added to the media variables.
Under the Update context menu tab By selecting Add “Open Folder as Project”, we have the ability to open it in the Pycharm program as a project by right-clicking on a folder. Under the Create Associations tab By selecting .py By clicking on the Python file with the .py extension, we have the ability to open directly with the Pycharm program. By selecting Download and Install JRE x86 by JetBrains, we allow the Pycharm program to install Java for smooth operation and We’re moving forward with the next button.
5. We start pycharm installation with the Install button without making any changes to the incoming window.
6. We are restarting our computer with the Finish button by selecting Reboot Now, and pycharm setup is thus complete.
1. We can now create projects and develop software on our computer. I will manage all of our lessons under this folder by creating a folder as Python on the desktop. You can proceed the same way if you wish.
2. We open the Pycharm program by double-clicking on the shortcut. Since we don’t have specific settings for Pycharm before, we click ok button by selecting Do not import settings.
3.To help develop Pycharm, I prefer to send JetBrains my usage information with Send Usage Statistics. You’re free to move forward with any choice.
4. In the choice of user interface I prefer the dark one and click skip remaining and set defaults. You can still choose any of you.
5. An existing project with Open in the Pop-up Pycharm window can be opened but we are moving forward by clicking Create New Project to create a new project.
6. We click the folder mark in the Location area.
7. We select the Python folder that we create on the desktop.
8. Create button and we create our project. It may take some time to adjust, apply, and complete the index process when the first project is created. Don’t worry, we just wait for this process when creating a new project. We will not encounter this waiting process again when opening the existing project.
9. Also, the Type of the Day pop-up window, where important tips are given at each program opening, appears. You can also passively disable Show tips on startup so that this window does not appear at the opening of each program. You can always reach the Type of the Day window at any time under the Help pop-up menu in the Pycharm top menu.
1.We see the Python project that we created on the Project panel on the left side. By right-clicking on it, we select Directory under the New pop-up menu. In the Name field, we click the OK button by typing 01. Since we have lesson 1, we have created a folder called 01. We will also create related lesson files under this folder.
2. Right-click on the folder named 01 to select Python File from the bottom of the New pop-up menu. We call the name section hello-world for our work file. In the Kind section, we make sure Python File is selected and click the OK button. And now our first Python file is formed.
3. We write these codes on the first line. We run our Run option codes from the drop-down menu by right-clicking in the field where we type print(“Hello World”).
There are many more options to run our codes on Pycharm. We can also run it with the Alt+Shift+F10 key combination from the keyboard. In the upper right corner, we can also run it with the green play button next to the file name. Pycharm can run our Python files from the Run pop-up menu in the top menu, or we can run it with the green play button on the Run tab at the bottom. You can choose the easy one for you. When we run our codes, we can track results and errors in the Run window at the bottom.
When we run our codes, we can track results and errors in the Run window at the bottom. Pycharm automatically saves our work files. If you wish, you can manually perform the recording with a ctrl+s key combination.
We created our first project and our first Python file. Now let’s take a look at our Project folder. When we visit the Python folder on the desktop, the .idea folder hosts project settings and details. The venv folder creates the virtual environment necessary for our project to work.
We’ll look inside the folder 01. We’re seeing our first Python work file we’ve created. By right-clicking on it, we can see the codes we wrote with Pycharm here by opening it with Notepad from the Open with menu.
As with every software language, comments lines are used with Python. Comment lines are used to add detailed information and descriptions about the code that is written. Now let’s practice with Python comment lines.
1. We return to our Pycharm program and right-click on folder 01 to select Python File under the New menu. We call the Name field comments. Again, after making sure that the file type in the Kind field is Python File, we create our file with the OK button.
2. Let’s print Hello World on the screen first. We’re running our code with run option by typing print(“Hello World”).
3. Let’s add comment lines now. With the # sign, we can add comments to each line with the # mark at the beginning of the line. Comments can be added to the bottom in the form of the # Python test comment. This way, when we run our code, we see that the comment lines are not processed.
4. If comments are to be added on more than one line, comments can be added as much as desired between the “”””comments”’ marks instead of putting #per line # per line. Again, when we run our code, we see that none of the comment lines are processed.