0% found this document useful (0 votes)
2 views

List and Dictionary Based Programming Questions

List

Uploaded by

gauravvirani3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

List and Dictionary Based Programming Questions

List

Uploaded by

gauravvirani3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

List & Dictionary based Questions

1. Start with the list[18,19,1]. Do the following using list functions

(a) Set the second entry (index 1) to 27

(b) Add 11, 45 and 66 to the end of the list.

(c) Remove the first entry from the list.

(d) Sort the list.

(e) Double the list.

(f) Insert 5 at index 1

2. If a is [1, 2, 3], is a *3 equivalent to a + a + a?

3. Predict the output:

4. WAP to search for an element in a given list of numbers.

5. WAP to count frequency of a given element in a list of numbers.

6. WAP that reverses an array of integers (in place)

7. WAP a program to generate a list of elements of Fibonacci Series.

8. WAP that repeatedly asks the user to enter product names and prices. Store all of them in a
dictionary whose keys are product names and values are prices. And also write a code to search an
item from the dictionary.

9. WAP to create a dictionary named year whose keys are month names and values are their
corresponding number of days.

10. wap to reverse a list elements.

11. wap to delete first three elements from a list.

12. wap to display all the elements reverse order.

13. wap to swap key and value pair of a Dictionary.

14. Write a program to input your names and marks and store them in dictionary as the key-value
pair. Perform the following operations on the dictionary:

(a) Display the Name and marks.

(b) Add a new key-value pair in this dictionary and display the modified dictionary.

(c) Delete a particular student from the dictionary.

(d) Modify the marks of an existing student.


(e) Display the dictionary in sorted order of names.

(f) Delete all the items from dictionary.

(g) Count the number of records present in dictionary.

15. wap to count number of values greater than 10 in a list of integers.

16. Python program to print all negative numbers in a range.

17. Python program to print all odd numbers in a range.

18. Python program to count Even and Odd numbers in a List

19. Python program to find second largest number in a list.

20. Python program to interchange first and last elements in a list.

21. Python program to Merging two Dictionaries.

22. Python program to find the size of a Dictionary.

You might also like