let x
=>
.map()
<div>
color: teal
______
______
Theebug
Theebug — Learn to Code by Doing
Light
Start Learning
Explorer
···
▼
THEEBUG
index.tsx
learn.md
docs.md
about.md
faq.md
leaderboard.md
privacy.md
learn.md
THEEBUG
›
learn.md
Python
Variables, functions, lists, and conditionals — the fundamentals of Python.
Start Course
Beginner
3 levels
01 — lesson1.py
easy
Variables
1
# Variables store data values
2
message = [ ___ ]
3
count = [ ___ ]
4
5
print(message, count)
Assign values to the variables so the program outputs "Hello World 42"
Play
02 — lesson2.py
easy
Functions
1
def add(a, b):
2
return [ ___ ]
3
4
result = add(3, 7)
5
print(result) # 10
Complete the "add" function so it returns the sum of a and b (should out…
Play
03 — lesson3.py
easy
List Length
1
fruits = ["apple", "banana", "cherry"]
2
3
for i in range([ ___ ](fruits)):
4
print(fruits[i])
Use the correct built-in function to loop through all fruits and print e…
Play
Intermediate
5 levels
04 — lesson4.py
medium
List Comprehensions
1
nums = [1, 2, 3, 4, 5]
2
doubled = [n [ ___ ] 2 for n in nums]
3
4
print(doubled)
5
# [2, 4, 6, 8, 10]
Complete the list comprehension so it doubles every number
Play
05 — lesson5.py
medium
Conditionals
1
def check_age(age):
2
if age [ ___ ] 18:
3
return "You can vote!"
4
return "Too young"
5
Add the right comparison operator to check if age is 18 OR older
Play
06 — lesson6.py
medium
Dictionaries
1
user = {"name": "Ada", "age": 30}
2
name = user[[ ___ ]]
3
print(name)
Access the user's name from the dictionary using the correct key
Play
07 — lesson7.py
medium
Loops
1
fruits = ["apple", "banana", "cherry"]
2
for fruit [ ___ ] fruits:
3
print(fruit)
Complete the for loop to print each fruit
Play
08 — lesson8.py
medium
f-strings
1
name = "Ada"
2
age = 30
3
bio = f"{name} is [ ___ ] years old"
4
print(bio)
Complete the f-string to interpolate the age variable
Play
Advanced
1 level
09 — lesson9.py
hard
Error Handling
1
def parse_number(text):
2
try:
3
return int(text)
4
[ ___ ] ValueError:
5
return None
Complete the try/except so a parsing failure returns None instead of cra…
Play
main
UTF-8
Markdown