float
or enclosing it in double quotes
if it’s a str
.
9 / 3
9 // 3
10 // 3
10 % 3
3 % 10
2 ** 3
"abc" + "def"
"baa " * 2
(9 % ( 6 // 2))
9 % 6 // 2
2 ** 2 ** 4
("na" * 8 + " ") * 2 + "Batman!"
1 + 2 ** 3 / 4 * 5 - (6 % 7)
For each of the following, say whether it is a statement or an expression:
a = 4
a + 4
int(6.4) + 2
Suppose we run the following program, and the user types
6
and presses enter. What happens?
= input("Enter a number: ")
user_num = 5 % (3 ** (user_num // 4)) result
Suppose we run the following program, and the user types
6
and presses enter. What value gets stored in
result
?
= int(input("Enter a number: "))
user_num = 5 % (3 ** (user_num // 4)) result
What does the following expression evaluate to?
float(str(int(2.6 / 2))*2)