Chapter 0 · Section 1 practice

Values, Numbers and Strings

0 of 4 answered

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 1
  • 3.0 -3.0 1
  • 3 -4 1
  • 3.33 -3.33 1

Question 2

What does print(0.1 + 0.2 == 0.3) print?

  • True
  • False
  • 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