What are the two ways to write a comment in python?
Either
# for short comments
or
""" For Longer comments """
How many possible outcomes are there for a boolean value?
2 - either true or false
What is the logical operator if we want to check if something is equal to something else?
What is wrong with this code?
x = int(4+5)
print( "The number is " + (X)
X must be turned back into a string
What kind of variable is this?
x = "Hi there"
String
Given the variable X, how would I write to round the variable to the nearest two decimal places?
round (x, 2)
What does this python expression evaluate to?
100 != 100
False
Why is this code getting an error statement?
x = 4
if x == 3
print("I am not 4)
The code is missing a colon
What does the following python program print?
x = "I am"
y = 6
z = "feet tall"
print(x)
print(Z)
print(Y)
I am
feet tall
6
What does this program print?
favorite_color = "blue"
if favorite_color != "blue":
if favorite_color != "red":
print ("must be yellow")
elif favorite_color == "blue":
print ("Must be blue")
Must be blue
Which of the following is not a comparison operator?
A. <= x
B. != X
C. > x
D. ?= X
D. ?= X
x = input ("what is your age?")
print( "You will be " + (x +1) + "years old next year")
x + 1 needs to be turned back into a string
How would you write code that prints "what a funny color" if the input for the question "what is a funny color?" is brown
x = input ("What is a funny color?")
if x == "brown":
print("What a funny color")
Why will this code not print?
b = True
if True:
print("b is True!")
if b:
What will print for this comparison operator?
x = int(5 +7)
if x >= 16:
print("The answer is 16")
else:
print("The answer is not 16")
The answer is not 16
If someone prints the following statement, why is there an error statement? You must identify two errors
administrator = input("Are you an administrator?)
If adminestrator == "Yes"
print("You get keys!")
There is a quotation mark missing, a colon is missing and administrator is misspelled