Professional Documents
Culture Documents
Exercise Questions: 1. What Will Be The Output of The Following Statements? Solution-A)
Exercise Questions: 1. What Will Be The Output of The Following Statements? Solution-A)
Exercise Questions: 1. What Will Be The Output of The Following Statements? Solution-A)
B)
C)
D)
2. Consider the following list myList. What will be the
elements of myList after each of the following operations?
Solution-
A)
B)
B)
C)
5. Differentiate between append () and extend ()
methods of list.
Solution-
append adds its argument as a single element
to the end of a list. The length of the list itself
will increase by one.
extend iterates over its argument adding each
element to the list, extending the list. The
length of the list will increase by however
many elements were in the alterable
argument
6. Consider a list:
list1 = [6,7,8,9]
What is the difference between the following operations
on list1:
Solution-
A)
B)
C)
7. The record of a student (Name, Roll No, Marks in five
subjects and percentage of marks) is stored in the
following list:
stRecord = ['Raman','A-36’, [56,98,99,72,69], 78.8]
C) print(stateCapital.values()
D) print(stateCapital.items())
E) print(len(stateCapital))
F) print("Maharashtra" in stateCapital)
G) print(stateCapital.get("Assam"))
H) del stateCapital["Assam"]
print(stateCapital)