Python Revision Tour - II - Homework
Python Revision Tour - II - Homework
Python Revision Tour - II - Homework
8. Which of the following option will not result in an error when performed on tuple in
Python, where tup1=(5, 6, 8, 9)?
(a) tup1[1]=12 (b) tup1.append(2) (c) tup=tup1+tup1 (d) tup1.sort()
9. dic1={“A”:15,“B”:16,“C”:17}
print(dic1[1])
What will be the output of above Python code?
(a) B (b) 16 (c) {“B”:16} (d) Error
11. Which of the following two Python codes will give same output?
If tup1=(1, 2, 3, 4, 5)
(i) print(tup1[:-1]) (ii) print(tup1[0:5])
(iii) print(tup1[0:4]) (iv) print(tup1[-4:])
(a) i, ii (b) ii, iv
(c) ii, v (d) i, iii