Variables, Input, and Printing
Mathematical Operators & Math Module
Strings Operations & Methods
Booleans & Conditionals
Functions
100

Make an integer variable with the name cookie and the value 3

cookie = 3
100

Given an integer x, make a variable cube and assign it the value of x cubed.

cube = x ** 3
100

Given a string variable penguin, print that variable with an ! at the end using concatenation

print(penguin + "!")
100

Make a variable is_good with the value True

is_good = True
100

Assume you have a function elsewhere called shenanigans that takes no parameters. Call this function.

shenanigans()
200

Make a string variable with the name year and the value 2025

year = '2025'
200

Add parentheses to the following so that value is equal to 6:

value = 3 * 3 - 1

value = 3 * (3 - 1)
200

Given an integer variable bob, repeat the word hello repeated bob times.

print(bob * "hello")
200

Without using logical operators, write an expression that will evaluate to True if some variable apple is NOT equal to another variable banana

apple != banana
200

Assume you have a function update_word that takes a string parameter and returns a different string. Pass this function the parameter "hello" and print the result

print(update_word("hello"))
300

Make a variable cake with a value provided by the user

cake = input("Enter a value: ")
300

Assume you have integer variables red and blue. Write an expression that calculates the remainder of red divided by blue.

red % blue
300

Given a string variable sandwich, print the string in all uppercase letters.

print(sandwich.upper())
300

Write an expression using the not operator that is equivalent to x < 3

not x >= 3
300

Write a function called square_this that takes a single int parameter x. It returns the square of x.

def square_this(x):
    return x ** 2
400

Make a variable potato with an integer value provided by the user

potato = int(input("Enter an integer value: "))
400

Import the math module

import math
400

Given a string variable flower, make a new variable called petal that is just the first and last letter of flower

petal = flower[0] + flower[-1]
400

Given a string variable word, write an expression that will evaluate to True if the word has more than 5 characters AND the word starts with lowercase k

len(word) > 5 and word[0] = 'k'
400

Write a function called greet that takes a single parameter called name. The function prints the message "Good morning, <name>!" but with the name replaced with the given value.

def greet(name):
    print(f"Good morning, {name}!")
500

Given two variables named cat and dog, print an f-string containing the two variables

print(f"My pets are {cat} and {dog}")
500

Assume you've already imported the math module, and that you have a variable called degrees. Write an expression that calculates the sine of degrees.

math.sin(math.radians(degrees))
500

Write an expression that counts the number of letter P's in the phrase "purple hippopotamus"

"purple hippopotamus".count("p")

500

Given two float variables abcd and efgh, write a code snippet that will print "Yay" if they are equal or "Nay" if they are not.

if abcd == efgh:
    print("Yay")
else:
    print("Nay")
500

Write a function first_and_last that takes a single string parameter password. If the first and last character of password are the same character, return the number 3. Otherwise, return the number 0.

def first_and_last(password):
    if password[0] == password[-1]:
        return 3
    else:
        return 0
M
e
n
u