First Python Programming Tutorial
Welcome to the exciting world of Python programming! If you are interested in learning how to write code, you have come to the right place.
Python is a very powerful, yet easy-to-learn programming language. Follow this course, and we guarantee that you will be able to write simple, yet useful applications within weeks.
We have designed this material for absolute beginners. Our goal with the course is to help you grasp the basics and lay a solid foundation for more advanced topics.
This tutorial will show you how to install Python and run your first program. Let’s get started!
1. Go to this page:
https://www.python.org/downloads/
2. Click the “Download Python” button. We will use a Windows PC for this example, but the download page has links to Python for Windows, Linux, macOS, and more.
3. Run the installation kit.
4. Open a Command Prompt on your Windows computer or the Terminal app on your Mac. Then, type “python3” (without using the quotes) and press the Enter key. If everything works okay, you will see an image that looks
like this:
5. Type the following line of code, and then press the Enter key:
print (5/3)
This simple Python instruction tells the interpreter, the application that executes our instructions, to divide 5 by 3, and then to display the result.
Don’t forget to use the parenthesis; earlier Python versions worked without them, but starting with Python 3, this is not
the case anymore. If you forget the parenthesis, you will get a SyntaxError, similar to the one in the image below:
You can use “/” to divide numbers, “*” to multiply them, “+” to add numbers, and “-” to subtract them. So go ahead and print out your own math results; you can also combine operations like this:
print (100 - 5 * 4 + 27 / 9)
Press Ctrl + Z to close Python when you are done playing with it.
This concludes our first Python tutorial. We hope you had fun with it, and we look forward to seeing you complete the next lesson.