State the value produced by each Python expression.
(a) 17 // 5
(b) 17 % 5
(c) 2 ** 3
(d) "hello"[1:4]
(e) 7 / 2[5]
- (a) 3(1)
- (b) 2(1)
- (c) 8(1)
- (d)
'ell'(accept ell or "ell", with or without quotes)(1) - (e) 3.5 (reject 3:
/is true division in Python 3)(1) - Answer: 3, 2, 8, 'ell', 3.5
- Examiner tip: The slice stops before index 4; students often include the final character or start at index 0.