Chapter 0 · Section 1 practice
Values, Numbers and Strings
These questions review the examples in the companion slides. Choose an answer, then check the explanation.
Question 1
What does print(10 // 3, -10 // 3, 10 % 3) print?
3 -3 13.0 -3.0 13 -4 13.33 -3.33 1
Question 2
What does print(0.1 + 0.2 == 0.3) print?
TrueFalse- It raises a
TypeError 0.3
Question 3
With s = ‘data Analysis’, what are s[0:4] and s[::2]?
'data'and'dt nlss''data 'and'dt nlss''data'and'aaAayi''dat'and'dt nlss'
Question 4
After s = ” hello, world “; s.upper(), what does print(s) show?
' HELLO, WORLD '' hello, world 'None- It raises an error