Variables &
Print Statements
Comparison Operators & Conditional Logic
Loops
Data Structures
(lists, dictionaries, & tuples)
User-Defined Functions
100

print("Hello World!)

Missing close-quote

100

x = 5

if x = 5:

    print(x)

Comparison operator is ==, not =

100

for i in range[5]:

    print(i)

Must use (), not [], for the range function

100

my_tuple = (1, 2, 3)

my_tuple[1] = 5

Tuples are immutable, cannot reassign value

100

def greet (name:

    print("Hello", name)

Missing closing parentheses ")" in definition

200

1st_number = 5

2nd_number = 6

total = 1st_number + 2nd_number

Improper variable names (cannot start with a number)

200

x = 15

if x > 10:

    print("Large")

if x < 5:

    print("Small")

else:

    print("Medium")

Should use elif instead of if for second statement, will print: 

"Large"

"Medium"

200

x = 5

while x < 10:

    print(x)

Infinite loop, never increase x or have a break statement

200

my_list = [1, 2, 3]

print(my_list[3])

Index error, max index of my_list is 2

200

def add(a, b):

    return a+b

print(add(2))

Missing argument/wrong number of arguments

300

r = float(input("Enter the radius of the circle:"))

pi = 3.14159265

circle_area = PI * r**2

PI not declared, pi is (case sensitive)

300

grade = 98

if grade >= 90:

    "A"

Missing print statement or variable declaration for "A"

300

for i in 5:

    print(i)

5 is not an iterable

300

my_list = [1, 2, 3, 4]

for i in range(len(my_list)):

    print(my_list[i+1])

Final iteration of the loop will have the index out of bounds

300

def double(x):

    x = x * 2

print(double(4))

Missing return statement

400

value = input("Enter a number:")

new_value = value + 5

Type error, must convert value to float/int first

400

age = 25

if age > 18 and < 30:

    print("Young adult")

missing left comparison value in second comparison statement

400

for char in "Python"

    print(char)

Missing colon at end of for loop statement

400

person = {"name": "Alice", "age": 21}

print(person["height"])

Key value "height" is not in the dictionary

400

def show():

    print(msg)

msg = "Hello World!"

show()

msg is not defined within nor passed to the function, variable scope issue

500

name = "Emily"

print("Hello {name}!")

Must use an f-string to format the name variable this way

500

score = 10

if score != 0:

    if score % 2 == 0:

    print("Even")

    else:

    print("Odd")

else:

    print("Zero")

Indentation error, nested if and else statement blocks must be indented again

500

for i in range(10):

    if i % 2 == 0:

        continue

    else:

        print(i, "is Even")

== should be !=, currently prints the odd numbers are even

500

my_list = [1, 2, 3]

my_list.append[4]

print(my_list)

The append method must use (), not []
500

def factorial(n):

    return n * factorial(n-1)

print(factorial(5))

Missing base case, function runs infinitely

M
e
n
u