Introduction
Python is a beginner-friendly programming language.
Last updated
Python is a beginner-friendly programming language.
Last updated
Python is a programming language. It lets you make desktop applications, web applications, bots, web crawlers and even Artificial Intelligence! With the right equipment, you can create robots, drones etc.
Fun fact: Python was created by Guido Van Rossum.
Python has two major versions: Python 2 and Python 3.
Python 3 is the "future" of Python. It's a significant improvement from Python 2. Python 3 code is guaranteed to work in all future versions. It's more elegant and readable than Python 2 as well. Python 2 is going to be deprecated (stop being supported) in 2020, so that means it will no longer get any more bug fixes. I highly recommend learning Python 3.
To start making cool stuff with Python, you need to install it.
Now, if you're just a beginner who wants to learn Python, you can either choose Python 3.6 or Python 3.7. Since Python 3.7 just came out, a few libraries such as Tensorflow (a package you use for Machine Learning or AI) don't quite support it yet. While there's no problem in using Python 3.7, for better compatibility with libraries you should get Python 3.6.
Windows does not have Python installed by default. Head over to https://www.python.org/downloads/, scroll down to "Looking for a specific release?" and select the latest version of Python 3.6. You will be redirected to a new page where you have to scroll down to "Files" and select the suitable package for you. If you're unsure which one to select, click on Windows x86-64 executable installer. it should start downloading a .exe
file. After it's done downloading, start the installing wizard and follow the steps. Make sure to check the box named "Add Python 3.6 to PATH" before starting.
Mac has Python 2 installed by default. But you will not be able to follow this tutorial with Python 2, so you should get Python 3. To install Python on Mac, you have two options. Go to https://www.python.org/downloads/, scroll down to "Looking for a specific release?" and select the latest version of Python 3.6. You'll be redirected to another page where you scroll down to "Files" and click on "macOS 64-bit Installer" or "macOS 64/32-bit Installer" depending on your machine's architecture. After it's finished downloading, fire up the installer and follow the instructions.
Or, if you have Homebrew installed, you can just brew install python
If you're on Linux, then you should already have Python 3 installed. But, just in case, open the Terminal and run python3 -V
if the output starts with 3.6, you're good to go. If it starts with 3.5, that's fine too.
If you do not have Python 3 installed, then follow the instructions below for your distribution.
Ubuntu: sudo apt install python3.6
Fedora: sudo yum install python3.6
Arch Linux: pacman -S python
For others, you can either look it up with Google or build from source.
Android: Install the PyDroid 3 app from Play Store.
iOS: Install the Pythonista app from App Store.
Now, you need to open the python "prompt" or "console". This is a place where you can run a line of python code at a time. On windows, open cmd.exe
, on Mac and Linux open the Terminal
and on mobile open the app you installed for your platform.
Now, on windows just enter python
and on Mac and Linux enter python3
.
You've successfully entered the Python prompt!
Alright. You've successfully installed and opened python. Now, get a paper notebook and a pen and jot down the date and time, for this is when you created your very first program! In the Python prompt, you should see a >>>
.
This is called a prompt. Now, the very first program most beginners create is called the "Hello, World!" program. enter this line of code:
print('Hello World')
in the prompt and press enter. You should see a nice little "Hello World" appearing on the next line.
Congrats, you've created your first program!
Yes. Python really is that simple. In the next tutorial you will set up a development environment and learn some of the basics of Python including the print
function.
Yes, I'll give you homework. Since practice is the only way you can learn to be a successful programmer. Your homework will be trying to produce different outputs with print
. Try adding more text.
If you're stuck, feel free to email me at memoryerror@yandex.com or if you have a discord account join my server at https://discord.gg/6Au9jQy where you can ask for help from anyone.