Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Department of Computer Science and Engineering,

School of Technology,
Pandit Deendayal Energy University (PDEU)
Fundamentals of Python Programming Lab (20CP102P)

Lab 6
1. WAP to remove multiple elements from a list.
2. Given a list of elements, perform grouping of similar elements, as different key-value list
in dictionary.
Input : test_list = [4, 6, 6, 4, 2, 2, 4, 8, 5, 8] -> Output : {4: [4, 4, 4], 6: [6, 6], 2: [2, 2], 8:
[8, 8], 5: [5]}
Input : test_list = [7, 7, 7, 7] -> Output : {7 : [7, 7, 7, 7]}
3. WAP that takes two lists and returns True if they have at least one common member.
4. WAP program to print a specified list after removing the 0th, 2nd, 4th and 5th elements.
5. Write a Python script to concatenate following dictionaries to create a new one.
dic1={1:10, 2:20} dic2={3:30, 4:40} dic3={5:50,6:60}
6. Sort a tuple of tuples by 2nd item
Input: tuple1 = (('a', 23),('b', 37),('c', 11), ('d',29))
Output: (('c', 11), ('a', 23), ('d', 29), ('b', 37))

Outcome: The student will refresh the concepts of List manipulation, tuples, and
dictionary.

You might also like