Data Types
Math Operations
Formatting Print Statements
Functions
Modules and Miscellaneous
100

What data type is the following value:

"password123!"

string

100

What is the mathematical operator for an exponent?

**

100

What will the following line of code print to the console?

print("Hello", "there" + "!")

Hello there!

100

What punctuation follows all calls to functions?

Parentheses ()

100

Fill in the blank of the following code, written to calculate the area of a circle:

area = _________* r **2

math.pi

200

What data type would be best for representing the price of gas?

float

200

What does modulus mean?

Whole number remainder after dividing
200

What is the difference between + and , in a print statement?

+'s leave no space, commas leave a space

200

Write a line of code that will allow the user to input their name, and store it in a variable called name.

name = input("What is your name?")

200

Write a line of code that would store a random number between 5 and 10 (inclusive) in a variable called x. You may assume that the random module has already been imported.

x = random.randint(5, 10)

300

What is the problem with the following code?

current_gen = 18

print("iPhone " + current_gen)

You cannot use a + to combine a string and an integer.

300

What is the difference between / and //?

Regular division (float answer) vs integer division (integer answer)

300

What symbol is used to concatenate two strings?

+

300

Observe the following line of code:

age = int(input("What is your age?"))

What is the purpose of int()?

input() normally reads in a string. int() will save the data as an integer.

300

In order to use anything from the math module, what must you first write at the top of your code?

import math

400

What value would the code below produce?

str(5.6)

"5.6"

400

What is the value of x after the following lines of code?

x = 2

x += 4

x /= 2

x = 3
400

What does the additional argument end= replace?

The default new line at the end of a printed statement.

400

What do we call the values inside of the parentheses of a function?

Arguments

400

Look at the following attempted variable name:

2nd option!

What are three reasons why this variable name is invalid?

The space, the "!", and the leading number.

500

What value would the code below produce?

int("5.6")

Error

500

What is the value of x after the following lines of code?

x = 3

x *= 2

x += (40 - x**2)

x = x % 3

x = 1

500

What will the following print?

print("Hip", "Hip", "Hooray", sep="! ")

Hip! Hip! Hooray

500

dogs = input("How many dogs?")

cats = input("How many cats?")

print("There are", dogs+cats, "animals.")

Susan runs her program above, inputting 1 (for dogs) and then 3  (for cats). What will print to the console?

There are 13 animals.

500

What does the following evaluate to?

abs(3 - math.sqrt(36)) + 8 // 3

5
M
e
n
u