Q. Create a dictionary 'ODD' of odd numbers between 1 and 10, where the key is the decimal number and the value is the corresponding number in words. Perform the following operations on this dictionary:


(a) Display the keys

(b) Display the values

(c) Display the items

(d) Find the length of the dictionary

(e) Check if 7 is present or not

(f) Check if 2 is present or not

(g) Retrieve the value corresponding to the key 9

(h) Delete the item from the dictionary corresponding to the key 9


Answer =


Let the dictionary name is ‘dic’.


(a) dic.keys()

(b) dic.values()

(c) dic.items()

(d) len( dic )

(e) 7.0 in dic

(f)  2.0 in dic

(g) dic[ 9.0 ]

(h) del dic [ 9.0 ]

9 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. thnakyou so much

    ReplyDelete
  2. It is clearly mentioned that create a dictionary 'ODD'. Then why did the answer used 'dic' as the name of the dictionary.

    ReplyDelete
  3. HI PPPPPPPPPPPPPPPPPPPPPPAAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHHHHHHHHHHHHHHHHH WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post