What's up guys? I hope you are all well. Today I am starting a series with this blog called "Python Programming for Beginners". In this series you will get the basic idea. In today's article I will show you how to install Python on your computer and write your first Python program. I assume you have a basic idea of computers.
How do I download and install Python?
I will first show you how to install Python in Windows. Below I am mentioning the steps with pictures:
- First you need to go to any browser and go to https://python.org.
- Then place your mouse over the “Download” button and under the “Download for Windows” text you will see “Python 3.9.0”. Then download it.
- Now you need to open the downloaded setup file. Then the following window will appear. At the bottom of this window is a checkbox that says "Add python to PATH". You have to enable it by clicking. Now you have to click on “Install Now” button.
- The install will start. We have to wait a while.
- When the installation is complete, click the Close button.
- Our installation is finished. Now we will open “Command Prompt” and type “python” and press enter.
In most cases, Python is installed on Linux. If not, open the terminal and type “sudo apt get install python3 python3-pip” and enter the password and Python will be installed. Then type “python3” in the terminal and press enter, Python will turn on.
My first program in Python:
Congratulations if you have done everything right so far and if Python runs without any problems! If you find any problems after installing Python, let us know. Now we will open “Command Prompt” and type “python” and press Enter. Open a terminal in Linux and type "python3" to turn on Python. Now here you type the following code and press enter.
You see, after writing this, Python gave you the "Hello World" output. Congratulations! You successfully wrote and ran the first Python program of your life.
How does Python work?
At the beginning of the code we wrote print. What is this print again? Do you eat or drink? It's actually a function. If we give anything in it, it will give us the output. Again, we wrote "Hello World" inside the first bracket. Type the name of the function in Python and type what you want to send to its function inside the first bracket. If you notice, you can see that I have written Hello World inside the print function. By this we call it Hello World a string. In the case of programming, string means sentence. The same thing would happen if we wrote "Hello World" inside ‘.
So far today. New part will come soon. Until then you can see about it on Google. But before I end, I'll show you a funny thing. But we can do our little calculations with Python if we want. For example: I want to find out what 2 + 2 is equal to, so if I want to find out with Python, I will type 2 + 2. Then Python will answer us 4. In this way, we can do a little calculation in Python!
0 Comments
If you have any doubts, please let me know.
Emoji