PRINT & VARIABLES
INPUT & DATA TYPES
OPERATORS
CONDITIONS & LOGIC
DEBUG & TRACE
100

Write Python code that displays:

Hello, World!

print("Hello, World!")

100

Ask the user to enter their name.

name = input("Enter your name: ")

100

What is the output?

print(5 + 3)

8

100

Complete the code:

age = 15


if age >= 13:

    ____________

Make it display:

Teenager

print("Teenager")

100

Find the error:

print("Hello"

Missing closing parenthesis:

print("Hello")

200

Write one line of code that displays:

Hello 5

print("Hello", 5)

200

Ask the user for their age and store the answer in age.

age = input("Enter your age: ")

200

What is the output?

print(10 % 3)

1

200

Complete the condition so the program prints "Adult" when age is 18 or older.

age = 20


if ____________:

    print("Adult")

age >= 18

200

Find the error:

if age >= 13

    print("Teenager")

Missing colon after the condition.

Correct:

if age >= 13:

    print("Teenager")

300

Create a variable called age and store the value 15.

age = 15

300

The user enters:

Ana

What will this display?

name = input("Enter your name: ")

print(type(name))

<class 'str'>

300

What is the output?

print(7 // 2)

3

300

Complete the code:

score = 85


if score >= 90:

    grade = "A"

elif ____________:

    grade = "B"

else:

    grade = "C"

score >= 80

300

What will this display?

x = "5"

y = 5


print(x == y)

False

Because "5" is a string while 5 is an integer.

400

Create three variables:

name = Ana

age = 15

grade = 8

Then print them.

name = "Ana"

age = 15

grade = 8


print(name)

print(age)

print(grade)

400

The user enters 5.

What is wrong with this program?

num = input("Enter a number: ")

print(num + 1)

input() returns a string, so num contains "5" rather than the integer 5.

400

What is the output?

print(2 ** 3)

8

400

What will this display?

age = 15


print(age >= 13 and age <= 19)

True

400

What will this display?

count = 0

count = count + 1

print(count)

1

500

Write a program that stores:

name = Ana

age = 15

and displays:

My name is Ana and I am 15 years old.

name = "Ana"

age = 15


print("My name is", name, "and I am", age, "years old.")

500

Fix the program so the user can enter a number and the program adds 1.

num = input("Enter a number: ")

print(num + 1)

num = int(input("Enter a number: "))

print(num + 1)

500

Without running the code, determine the output:

print(5 + 3 * 2)

11

Why?

Multiplication happens before addition:

3 × 2 = 6

5 + 6 = 11


500

Write a program that asks for a score.

If the score is:

  • 90 or higher → "Excellent"
  • 80–89 → "Good"
  • Below 80 → "Needs Improvement"

score = int(input("Enter your score: "))


if score >= 90:

    print("Excellent")

elif score >= 80:

    print("Good")

else:

    print("Needs Improvement")

500

Fix this entire program:

name = input("Enter your name: ")

age = input("Enter your age: ")


if age >= 18

print(name, "is an adult")

else:

print(name, "is a minor")

name = input("Enter your name: ")

age = int(input("Enter your age: "))


if age >= 18:

    print(name, "is an adult")

else:

    print(name, "is a minor")