PES
EN English 한국어 日本語 中文 हिन्दी বাংলা اردو Español Português Français Deutsch Русский العربية Bahasa Indonesia Tiếng Việt ไทย Türkçe

How to enable notifications

Notifications are unavailable in this browser or on this address. Try a supported browser on the secure PES site.

If notifications are blocked, allow them in your browser settings.

  1. Open the site controls beside the address bar, or your browser’s site settings. Set Notifications for this site to Allow.
  2. In your device settings, allow notifications for your browser and check Do Not Disturb or Focus.
  3. Return to PES, reload the page, and use the bell to enable notifications.

On iPhone or iPad, add PES to your Home Screen, open it there, then allow notifications.

My learning progress
  1. How to use AI
  2. Terminal commands
  3. Advanced AI
  4. Vibe coding
  5. AI certification Getting ready
  6. Keyboard
See details
Learn the Python language

9 steps of Python you code right in your browser

No installation or sign-up needed. Type your code, pause a moment, and it runs right away, so you learn while watching the results. The very language used to build AI starts right here.

Completed steps
0/9
Progress
0%
Runs
0
  1. 1. Talk to the computer Use print to show what you want to say on the screen Not started yet
  2. 2. Put a name tag on a value Store a value in a variable and use it again Not started yet
  3. 3. Calculate with numbers Numbers need no quotes, so you can add them right away Not started yet
  4. 4. Calculate like a calculator Learn plus, minus, times and divide Not started yet
  5. 5. What if? Make a fork in the road Use if to act differently in different situations Not started yet
  6. 6. Repeat many times Use for to do the same thing again and again Not started yet
  7. 7. Put many things in a box A list groups many values into one Not started yet
  8. 8. Find values by name tag A dictionary pairs names with values Not started yet
  9. 9. Make your own magic spell Use def to make your own command (a function) Not started yet

Real Python runs inside your browser (Pyodide). It downloads the runtime just once the first time, and after that it runs fast. If you want to learn more deeply, continue on to the Build Your Own AI lab.

Step 1 / 9

Passed! You completed step 1. Shall we move on to the next step?

Talk to the computer

Use print to show what you want to say on the screen

Shall we make the computer talk? print() is a magic command that makes the computer "say" words on the screen. Write what you want to say inside the quotes " ", and the computer shows it just as it is. The double quotes are a fence that says "the words go from here to here."

Goal · Use print() to show anything you want to say. If words appear on the screen, you did it!

You succeed if it looks like this!

Hello, Python!

I am learning Python

(The words inside the quotes show up just as you wrote them)

You've opened all hints

  1. Put the words, wrapped in quotes, inside the brackets of print( ).

  2. Example: print("I am learning Python")

  3. If you forget the quotes, the computer won’t understand. Always wrap your words "like this".

Step 2 / 9

Passed! You completed step 2. Shall we move on to the next step?

Put a name tag on a value

Store a value in a variable and use it again

Just like putting a name tag on a toy box, you can give a value a name. Write name = value, and after that you only need to call the name to get the value back. A value with a name tag like this is called a "variable". Here = does not mean "equals". It means "put this value into this name".

Goal · Put your own name into the variable name. Then the computer will say hello with your name!

You succeed if it looks like this!

My name is (the name you typed)

— The name on your name tag shows up in the greeting

You've opened all hints

  1. Write your name between the quotes. Example: name = "Alex"

  2. The left side of = is the name tag. The right side is the value that goes inside it.

  3. Just write a name inside the quotes, like name = "Sam".

Step 3 / 9

Passed! You completed step 3. Shall we move on to the next step?

Calculate with numbers

Numbers need no quotes, so you can add them right away

We wrapped words in quotes, but numbers are written just as they are, with no quotes. Then the computer knows they are real numbers and can even do math with them! You can add like 3 + 5, and keep the answer in a name tag (a variable).

Goal · Put apples plus bananas into total, so there are 8 fruits in all.

You succeed if it looks like this!

Fruits in total: 8

— 3 apples + 5 bananas = 8!

You've opened all hints

  1. To add, use the + sign.

  2. You can add name tags together too, like total = apples + bananas.

  3. Write total = apples + bananas and total becomes 8.

Step 4 / 9

Passed! You completed step 4. Shall we move on to the next step?

Calculate like a calculator

Learn plus, minus, times and divide

Python is a clever calculator. Use + to add and - to subtract. To multiply, use * instead of ×, and to divide, use / instead of ÷. The area of a rectangular room is "width × height", and you tell the computer width * height.

Goal · Multiply width by height so the area of the room becomes 48.

You succeed if it looks like this!

The area of the room is 48

— width 8 × height 6 = 48!

You've opened all hints

  1. To multiply, use the * sign, not ×.

  2. Multiply with a star, like area = width * height.

  3. Write area = width * height and you get 48.

Step 5 / 9

Passed! You completed step 5. Shall we move on to the next step?

What if? Make a fork in the road

Use if to act differently in different situations

"If it rains, take an umbrella. If not, just go out." The computer can make forks in the road like this too. if condition: means "if the condition is true", and else: means "otherwise". Lines inside a fork must start with 4 spaces (indentation), so the computer knows "this line is inside the fork".

Goal · If score is 60 or more, put "pass" into grade. Otherwise, put "fail". (The score right now is 85!)

You succeed if it looks like this!

Result: pass

— 85 is more than 60, so it is "pass"!

You've opened all hints

  1. Write if score >= 60: and on the next line, after 4 spaces, write grade = "pass".

  2. On the line under else:, write grade = "fail" (also after 4 spaces).

  3. if score >= 60:
        grade = "pass"
    else:
        grade = "fail"
Step 6 / 9

Passed! You completed step 6. Shall we move on to the next step?

Repeat many times

Use for to do the same thing again and again

Counting and adding from 1 to 10 one by one would make your hands tired, right? Computers are great at repeating. for number in range(1, 11): means "put 1, 2, 3 … 10 into number one after another, and repeat". (range(1, 11) means 1 to 10.) Inside the loop, you can keep adding values little by little.

Goal · Add up all the numbers from 1 to 10 so that total becomes 55.

You succeed if it looks like this!

1 to 10 added up: 55

— 1 + 2 + 3 + … + 10 = 55!

You've opened all hints

  1. Inside the loop, keep adding number to the old total, like total = total + number.

  2. total = 0 should appear only once, at the top, before the loop starts.

  3. Change the line inside the loop to total = total + number and you get 55.

Step 7 / 9

Passed! You completed step 7. Shall we move on to the next step?

Put many things in a box

A list groups many values into one

Just like putting many pencils into one pencil case, you can put many values into one box. This box is called a "list", and you make it with square brackets [ ]. To put something new into the box, use box.append("thing"), and to count what is inside, use len(box).

Goal · Put one more "orange" into the fruits box so there are 4 fruits in all.

You succeed if it looks like this!

['apple', 'pear', 'grape', 'orange']

Count: 4

— The orange went in, so now there are 4!

You've opened all hints

  1. To put something into the box, write fruits.append("orange").

  2. append adds the new thing to the very end of the box.

  3. Just add one line: fruits.append("orange").

Step 8 / 9

Passed! You completed step 8. Shall we move on to the next step?

Find values by name tag

A dictionary pairs names with values

When you look up a word in a dictionary, you find its meaning, right? A Python dictionary works the same way. Give it the name tag (key) "reading" and you get the score (value) 90. You make it with curly braces { }, and add a new pair like scores["science"] = 100. Name tags let you find values very quickly.

Goal · Add "science": 100 to scores, then work out the average of the three subjects (reading, math, science) so that it is 90.

You succeed if it looks like this!

{'reading': 90, 'math': 80, 'science': 100}

Average: 90.0

— The average of the three subjects is 90!

You've opened all hints

  1. To add a new pair, write scores["science"] = 100.

  2. The average is (90 + 80 + 100) divided by 3.

  3. Write scores["science"] = 100, then average = (90 + 80 + 100) / 3.

Step 9 / 9

Passed! You completed step 9. Shall we move on to the next step?

Make your own magic spell

Use def to make your own command (a function)

If you do the same thing often, it helps to make your own magic spell. This spell is called a "function". def double(x): means "make a spell called double that takes x as its ingredient", and return means "give this value back". Once you make it, you can use it again and again, like double(10) or double(7).

Goal · Finish the spell double: it takes a number and gives back that number made twice as big.

You succeed if it looks like this!

20

14

— double(10) gives back 20, and double(7) gives back 14!

You've opened all hints

  1. Twice as big is x * 2.

  2. Write the value to give back after return.

  3. Change it to return x * 2 and your spell is complete.

Preparing the Python runtime…

Python code

Output


                        

Almost there!

Guidelines

AI

AI Certification

Study

Vibe Coding

Game

Practice

Tutors

Chat

Forum

Create

Community

More

Glossary

Pick a word you don't know. You'll see a simple explanation and related terms.

No matching term yet.

Pick a term to see its explanation.