Page 96 - Modular v1.1 Pyhton
P. 96

SOME MORE PROGRAMS

                  Program 4: To remove or delete elements from a dictionary.













                  On running the above program, you will get the following output:





                                      {'Name': 'A', 'Rollno': 1, 'Marks': [10, 20, 30], 'Mobile': 9876754534}
                                      1
                                      {'Name': 'A', 'Marks': [10, 20, 30], 'Mobile': 9876754534}
                                      ('Mobile', 9876754534)
                                      {'Name': 'A', 'Marks': [10, 20, 30]}
                                      None

                  Program 5: To convert dictionary to list of tuples.










                  On running the above program, you will get the following output:



















                     Recap


                            Python dictionary is another data type, which contains a collection of values in the form of key
                           value pairs.
                           The data element of a dictionary can be retrieved or accessed by its key value.
                            Dictionary is a heterogeneous collection of data elements, where key must be unique and
                           immutable.
                           Elements of the dictionary can be access by using  the key defined in the key:value pairs.






                   94     Touchpad MODULAR (Version 1.0)
   91   92   93   94   95   96   97   98   99   100   101