Python Exercises

Fill in the blanks to test your knowledge.

1

Print "Hello, World!" to the console

("Hello, World!")
2

Get the length of a list

count = (my_list)
3

Create a range from 0 to 9

for i in (10):
4

Define a function named greet

greet(name):
return f"Hello, {name}"
5

Add an item to a list

my_list.(42)
6

Check the type of a variable

print((x))
7

Convert a string to uppercase

text.() # "hello" -> "HELLO"
8

Import the math module

math
print(math.pi)
9

Sort a list in place

my_list.()
10

Use an f-string to format a message

msg = "Hello, {name}!"