Problem Wk.5.1.1: More expressions For each of the expressions below, specify its type and value. If it generates an error, select type noneType and put the word error in the box for the value. Assume we've made the following assignments: > a = 'hi' > x = [1,2,[3,'John',4],'Hi'] 1. a 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. noneType int float boolean function string list tuple a[0] a[1] a[2] x[0] x[2] x[-1] x[2][2] x[2][-1] x[-1][2] x[0:1] x[0:-1] len(x) (a, b, c, d) = x c range(3) range(3,10) range(3,10,3) range(10,3) range(10,3,-1) range(len(x)) 'hi' == 'Hi' 2 in x 3 in x 'John' in x 'Hi' in x sum(range(4)) [x for x in range(3)] [x*2 for x in range(3)] sum([x*2 for x in range(3)]) [-x for x in [8, 2, 1]] def fizz(x): return x + 1 This problem contains one or more multiple-choice questions. When a given set of choices is used for the first time, all choices are displayed. If there are several related questions, you can assume that the same choices are available for all questions. [fizz(fizz(x)) for x in [8, 2, 1]] 32. [x for x in range(10) if x%2 == 0] MIT OpenCourseWare http://ocw.mit.edu 6.01SC Introduction to Electrical Engineering and Computer Science Spring 2011 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.