Assignment 1
Assignment 1
dic={"lion":"wild","tiger":"wild","cat":"domestic","dog":"domestic"}
Q 4 Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers and n is a numeric value
by which all elements of the list are shifted to left. Sample Input Data of the list Arr= [10,20,30,40,12,11],
n=2
Output Arr = [30,40,12,11,10,20]
Q 6. Take a list l1 of 10 elements. Store even and odd number in two different list from list l1.
Q9. Write a program to input your friends name and their phone numbers, and store them as key value pair
in Dictionary Perform the following operations
a) Display name and phone number of all your friends
b) Search for a friends’ name in your list, if found display their phone number
c) Delete a particular friend
d) Modify the phone number of an existing friend
Page 1 of 2
Q 10 a. Differentiate between clear(), pop() and popitem() functions in Dictionary by giving example for
each.
b. Write the output of following Python code:
dict = {1: 4, 2: 5, 3: 1}
a=0
b=0
for i in dict.keys():
a=a+i
print(a)
for i in dict.values():
b=b+i
print(b)
Page 2 of 2