Syntax & Variables
Print/Input
Conditionals/Loops
Functions
Lists/Random
10

What data type uses quotation marks around it?

String

10

How do you properly print the following using one line of code: Hello World!

print("Hello World!")

10

What does elif mean and when is it used?

elif = else if

Used as a part of an if statement

10

What is the command used to create a function?

def

10

Create a list of three numbers with one line of code.

list1 = [1, 2, 3]

20

Which variable type can store decimals?

Floats

20

How do you take a number as input and store it as an integer using one line of code? You may put anything you want as the parameter to the input command provided it is the correct data type.

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

20
What is one way to create an infinite loop? You may provide an example piece of code to support your answer.

while True: will create an infinite loop

Also, any condition that never becomes false will also be an infinite loop

20

How can I call the following function with 5 and 7 as my inputs, respectively?

def mystery_function(num1: int, num2: int):

     # some code here

mystery_function(5, 7)

20

What statement must you always have at the start of any program that uses the random package and any of its functions?

import random

30

Name the five data types discussed in this class.

Int, Float, String, Boolean, and List
30

Create a single line of code that will: 

1. Prompt the user for their age. You may assume it will be under 18.

2. Print the following: You have ___ years left until you can vote!

print("You have", 18 - int(input("Enter your age: ")), "years until you can vote!")

30

What data type is the condition of a while loop?

Ex. while x > 5:

          # some code here

Boolean

30

Create a line of code that defines a function with 5 parameters: 1 must be a float, 1 must be a String, 2 must be integers, and 1 must be a Boolean.

def some_function(param1: float, param2: str, param3: int, param4: int, param5: bool)

30

Write one line of code that prints the square of a randomly generated number between 1 and 10.

print(random.randint(1, 10)**2)