What function displays information on the screen?
print()
What symbol assigns a value to a variable?
Equal symbol ( = ) is the assignment operator
Which function converts a value to a floating-point number?
float()
Which keyword begins a decision statement?
if
What does the indentation tell Python in a nested if statement?
Which statements belong to the if, elif, or else.
What escape sequence moves output to the next line?
\n
What data type is returned by input()?
string
What is the value of result?
result = (8 + 4) * 3 - 6 / 2
33
Which keyword provides another condition after an if?
elif
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.
What does \t do inside a string?
Tabs data over 5 spaces
Is this a valid variable name? Why or why not?
2ndPlace = 'Sam'
No.
A variable name cannot begin with a number.
What string method can be used to convert user input such as 'YES' or 'Yes' to lowercase for easier comparison?
.lower()
What Python structure allows a program to choose between different actions based on whether conditions are true or false?
if/elif/else
In a Python if statement, what type of value does a comparison such as score >= 100 produce?
Boolean (True or False)
What is wrong with this statement?
print('Joe's computer')
The apostrophe ends the string early.
String should of used quotes (" ")
What is the term for a named memory space used to store data that a program can access and change?
Variable
If you only wanted to get the remainder after one number is divided by another, which operator would you use?
Modulus operator ( % )
Which logical operator requires both conditions to be true for the overall condition to be true?
and
In a nested if statement, when will the inner if statement be evaluated?
Only when the outer if is evaluated to True
What will this display?
print('Python\n\tRocks!')
Python on one line, with Rocks! tabbed on the next line.
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()
When Python evaluates 10 / 4, what type of value does the / operator return?
float
In a condition using both and and or, which operator is evaluated first?
and
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'):