This lesson introduces the most essential beginner topics of Python programming.
Press the 'Next' button to proceed with the lesson.
On the right are two boxes. One is for writing code in. The other shows the result of running your code.
Press the 'Run Code' button and see what happens.
After running the code, you should see a number appear in the 'Output' box.
Then press 'Next' to continue to the next slide.
The code you ran used
123 in the output box.
Your first challenge is to change the code so it shows the number
2 in the
output box when you run it.
Therefore, change the code in the code box from
Then press 'Submit Answer' to check your solution before continuing.
Python programs can have more than one line. Some programs have hundreds of lines of code.
Here is an example of a program with two lines of code:
Python will run the lines one at a time, starting at the top. When a
Try to run the code and see what it does.
Then change the code so that it prints
10 on the first line, and
on the next line. Submit your answer before continuing.
Using print from scratch
Now that you have seen some examples of using
42 in the
You can refer back to previous slides if you don't remember exactly how to use
Note that upper- and lowercase letters, spelling, and parentheses must all be correct when writing code -- otherwise Python won't understand you. Make sure you follow the previous examples closely.
If you put a math expression into
Here is an example of code that calculates and prints
Use this as a basis for your own addition program.
To continue, write code that calculates
123 + 456
and prints the result.
Multiplying and subtracting
42 * 56. Then calculate
88 - 512.
If you are not sure how to proceed, try pressing the Hint button.
Use a single
If you need a hint, you can press the 'Hint' button.
Congratulations on completing the first lesson! You are now familiar with
The rest of the course covers all the fundamental concepts you'll need to become competent at programming.
The next lessons introduce strings - a way to represent text - and variables, which let you store values for later use.