Print & Strings
Variables & Input
Math & Types
Decisions
Logic & Nesting
100

What function displays information on the screen?

print()

100

What symbol assigns a value to a variable?

Equal symbol ( = ) is the assignment operator

100

Which function converts a value to a floating-point number?

float()

100

Which keyword begins a decision statement?

if

100

What does the indentation tell Python in a nested if statement?

Which statements belong to the if, elif, or else.

200

What escape sequence moves output to the next line?

\n

200

What data type is returned by input()?

string

200

What is the value of result?

result = (8 + 4) * 3 - 6 / 2

33

200

Which keyword provides another condition after an if?

elif

200

What will print?

level = 8

key = 'no'

if level >= 5:

    if key == 'yes':

        print('Access granted.')

    else:

        print('Key required.')

else:

    print('Level too low.')

Key required.

300

What does \t do inside a string?

Tabs data over 5 spaces

300

Is this a valid variable name? Why or why not? 

2ndPlace = 'Sam'

No. 

A variable name cannot begin with a number.

300

What string method can be used to convert user input such as 'YES' or 'Yes' to lowercase for easier comparison?

.lower()

300

What Python structure allows a program to choose between different actions based on whether conditions are true or false?

if/elif/else

300

In a Python if statement, what type of value does a comparison such as score >= 100 produce?

Boolean (True or False)

400

What is wrong with this statement?

print('Joe's computer')

The apostrophe ends the string early.

String should of used quotes (" ")

400

What is the term for a named memory space used to store data that a program can access and change?

Variable

400

If you only wanted to get the remainder after one number is divided by another, which operator would you use?

Modulus operator ( % )

400

Which logical operator requires both conditions to be true for the overall condition to be true?

and

400

In a nested if statement, when will the inner if statement be evaluated?

Only when the outer if is evaluated to True

500

What will this display?

print('Python\n\tRocks!')

Python on one line, with Rocks! tabbed on the next line.

500

If a program needs to store information entered by the user so it can be used later, what Python function is used to collect that information?

input()

500

When Python evaluates 10 / 4, what type of value does the / operator return?

float

500

In a condition using both and and or, which operator is evaluated first?

and

500

How does Python group this condition - write it out!

if key == 'yes' or lock == 'open' and user == 'manager':

if key == 'yes' or (lock == 'open' and user == 'manager'):

M
e
n
u