Page 336 - AI Ver 1.0 Class 9
P. 336
4. Find the output of the following programs:
1. A list is declared as
marks = [20,15,45,25,30]
What will be the output of
print(3*marks[2] - 4*marks[4])
2. word=['P','R','O','G','R','A','M']
print(word[-4:])
print(word[::-2])
3. word=['P','R','O','G','R','A','M']
print(word.count('R'))
print(word.index('R'))
4. L=[1,2,3]
L*=3
print(L)
5. list1=[10,20]
list2=[30,40]
list1.append(25)
print(list1)
list1.extend(list2)
print(list1)
Answers
Exercise (Section A)
A. 1. d 2. b 3. c 4. a 5. c 6. b 7. a 8. c 9. c 10. b
11. b 12. a 13. b 14. a 15. b
B. 1. program 2. sequentia 3. True/False 4. step-by-step 5. interpreter
6. arithmetic 7. Single-line/Multi-line 8. type() 9. program 10. condition
11. two 12. entry-controlled loop 13. heterogeneous 14. mutable
15. Forward Indexing
E. 1. False 2. False 3. True 4. True 5. False 6. True
7. False 8. True 9. False 10. True 11. False 12. True
13. True 14. False 15. True
334 Touchpad Artificial Intelligence-IX

