Python is a programming language. You write code files, and then you can run the code files, and they'll do what you told them to do. This tutorial will teach you how to use python in a variety of situations. If this is your first programming language, hopefully this is a gateway to a new way of understanding the world!
There are two ways to approach this tutorial set. If you have time, we recommend installing python on your own computer:
- Go to the python website: https://www.python.org/downloads/
- Follow the python install instructions. If you are asked whether to "Add Python to PATH", press Yes or check the checkbox.
- Copy this set of code files, by pressing the green button on the upper right ("CODE") and download this code as a zip file. (Or, if you know how to use
git
, you can use that too.) - Download an editing tool e.g. visual studio code (https://code.visualstudio.com/). This will highlight the code and make it so much easier to read.
- Open each file with your editing tool (use
right click->open with
or otherwise). - Read each file and the included comments. When you're ready to run your program:
- [WINDOWS] Open a console window by pressing
shift+right click
in the file explorer where the code file is located. - Press
Open Powershell Window Here
- In the blue window that pops up, type in
python the_code_file.py
, then press enter.
- [WINDOWS] Open a console window by pressing
Alternatively, if you don't have much room on your computer, you can use an online python environment. We recommend https://repl.it/languages/python3. Then, instead of downloading the files here, you can copy the entire contents of the file into the window on the left, and press the run button when you're ready.
Alright, time to get started! The files in this repository include:
1_helloworld.py
2_variables.py
3_types.py
4_input.py
5_control.py
6_lists.py
7_dictionaries.py
8_functions.py
9_classes.py
10_libraries.py
If you have any edits to suggest, please email [email protected]
:)
Once you're done looking over all the files, try some of these challenges!
- A program that outputs triangular numbers
- A program that outputs prime numbers
- A program that simulates a projectile's motion
- A program that tells you the current system time
Happy coding!