-
Write an
if
statement that prints "Too big" if the value
of the variable number is greater than 100.
if number > 100:
print("Too big")
-
What are the only values that a boolean expression can have?
True and False
-
Write the Python boolean literals.
True and False
-
Write the boolean expression that is true if the value of the variable number_1
is greater than or equal to value of the variable number_2.
number_1 >= number_2
-
Write an
if
statement that prints "Too big" if the value of the variable
numb is greater than 1000.
if numb > 1000:
print("Too big")
-
Write an
if
/else
statement that prints
"Positive" if the value of the variable numb
is greater than or equal to 0, and prints "Negative" if it is not.
if numb >= 0:
print("Positive")
else:
print("Negative")
-
Write an
if
/elif
/else
statement that prints
"Positive" if the value of the variable numb
is greater than 0, and prints "Negative" if it is less than 0 and
print "Zero" otherwise.
if numb > 0:
print("Positive")
elif numb < 0:
print("Negative")
else:
print("Zero")
-
If you typed the following in the Python interactive mode,
what would the result be?
"foo" < "bar"
False
-
If you typed the following in the Python interactive mode,
what would the result be?
"sam" == "Sam"
False
-
If you typed the following in the Python interactive mode,
what would the result be?
5 != 6
True