Working With Lists and Dictionaries Class 11 IP NCERT Solution || Working With Lists and Dictionaries Information Practices NCERT Solution Class 11 || Working With Lists and Dictionaries Class 11 Information Practices NCERT Solution || Working With Lists and Dictionaries NCERT Class 11 IP Solution || NCERT Working With Lists and Dictionaries Class 11 Information Practices Solution || NCERT Python Solution Class 11 IP || MySQL NCERT Class 11 Solution || Working With Lists and Dictionaries Python NCERT Class 11 IP Solution
Note :- Please Click on question to get Answer of that Question !!
Exercise
Q1. What will be the output of the following statements?
i.list1 = [12,32,65,26,80,10]
list1.sort()
print(list1)
ii. list1 = [12,32,65,26,80,10]
sorted(list1)
print(list1)
iii. list1 = [1,2,3,4,5,6,7,8,9,10]
list1[::-2]
list1[:3] + list1[3:]
iv. list1 = [1,2,3,4,5]
list1[len(list1)-1]
Q2. Consider the following list myList. What will be the elements of myList after the following two operations:
myList = [10,20,30,40]
i. myList.append([50,60])
ii. myList.extend([80,90])
Q3. What will be the output of the following code segment:
myList = [1,2,3,4,5,6,7,8,9,10]
for i in range(0,len(myList)):
if i%2 == 0:
print(myList[i])
Q4. What will be the output of the following code segment:
a. myList = [1,2,3,4,5,6,7,8,9,10]
del myList[3:]
print(myList)
b. myList = [1,2,3,4,5,6,7,8,9,10]
del myList[:5]
print(myList)
c. myList = [1,2,3,4,5,6,7,8,9,10]
del myList[::2]
print(myList)
Q5. Differentiate between append() and extend() functions of list.
Q6. Consider a list:
list1 = [6,7,8,9]
What is the difference between the following operations on list1:
a. list1 * 2
b. list1 *= 2
c. list1 = list1 * 2
Q7. 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]
Write Python statements to retrieve the following information from the list stRecord.
a) Percentage of the student
b) Marks in the fifth subject
c) Maximum marks of the student
d) Roll no. of the student
e) Change the name of the student from ‘Raman’ to ‘Raghav’
Q8. Consider the following dictionary stateCapital:
stateCapital = {"AndhraPradesh":"Hyderabad","Bihar":"Patna","Maharashtra":"Mumbai",
"Rajasthan":"Jaipur"}
Find the output of the following statements:
i. print(stateCapital.get("Bihar"))
ii. print(stateCapital.keys())
iii. print(stateCapital.values())
iv. print(stateCapital.items())
v. print(len(stateCapital))
vi print("Maharashtra" in stateCapital)
vii. print(stateCapital.get("Assam"))
viii. del stateCapital ["Andhra Pradesh"]
print(stateCapital)
Programming Problems:-
Q1. Write a program to find the number of times an element occurs in the list.
Q2. Write a program to read a list of n integers (positive as well as negative). Create two new lists, one having all positive numbers and the other having all negative numbers from the given list. Print all three lists.
Q5. Write a program to read a list of elements. Modify this list so that it does not contain any duplicate elements, i.e., all elements occurring multiple times in the list should appear only once.
Q7. Write a program to read elements of a list.
a)The program should ask for the position of the element to be deleted from the list. Write a function to delete the element at the desired position in the list.
b)The program should ask for the value of the element to be deleted from the list. Write a function to delete the element of this value from the list.
Q8. Write a Python program to find the highest 2 values in a dictionary.
Q9. Write a Python program to create a dictionary from a string.
Note: Track the count of the letters from the string.
Sample string : 'w3resource'
Expected output : {'3': 1, 's': 1, 'r': 2, 'u': 1, 'w': 1, 'c': 1, 'e': 2, 'o': 1}
Q10. Write a program to input your friends’ names and their Phone Numbers and store them in the dictionary as the key-value pair. Perform the following operations on the dictionary:
a) Display the name and phone number of all your friends
b) Add a new key-value pair in this dictionary and display the modified dictionary
c) Delete a particular friend from the dictionary
d) Modify the phone number of an existing friend
e) Check if a friend is present in the dictionary or not
f) Display the dictionary in sorted order of names
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )