EXAM Flashcards
result?
4e2.is_integer()
True, its a conceptual integer even if it has a decimal point. i guess.
what is printed:
print(round(4.05, 1))
print(round(4.15, 1))
print(round(4.25, 1))
print(round(4.35, 1))
print(round(4.45, 1))
print(round(4.55, 1))
print(round(4.65, 1))
print(round(4.75, 1))
print(round(4.85, 1))
print(round(4.95, 1))
print(round(5.05, 1))
print()
print(round(5.05, 1))
print(round(5.15, 1))
print(round(5.25, 1))
print(round(5.35, 1))
print(round(5.45, 1))
print(round(5.55, 1))
print(round(5.65, 1))
print(round(5.75, 1))
print(round(5.85, 1))
print(round(5.95, 1))
print(round(6.05, 1))
print()
print(round(243, -2))
4.0
4.2
4.2
4.3
4.5
4.5
4.7
4.8
4.8
5.0
5.0
5.0
5.2
5.2
5.3
5.5
5.5
5.7
5.8
5.8
6.0
6.0
200
9/36?
4.0
what does this print:
x = 125.5
y = 124.5
print(f”rounded x is {x:.0f}, and rounded y is {y:.0f}”)
rounded x is 126, and rounded y is 124
[] vs. ()
[] for indices, () for functions like len(x)
what will this return:
print(4*“a”)
aaaa
can you use ! in python?
only in !=
what class is abs() in python?
none
difference between formatted string s or d and simply doing formatted {x}?
none, the d and s specifiers dont really do anything
what does this print?
x = 1234
print(f”hello” + str(x))
hello1234
what will this print?
x = 1234
print(f”hello {x:s}”)
ERROR
because s is a string specifier, does not work on ints