Find us on Facebook

Thursday, December 13, 2018

Dictionary


                              
Aim: Implement a Program to implement a dictionary comprehension.
Algorithm:
1.Start
2. Create a dictionary
3.Update existing entry
4.Add a new entry.
5.Print the updates.
6.Stop

Program:
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
dict['Age'] = 8       # update existing entry
dict['School'] = "DPS School"            # Add new entry
print "dict['Age']: ", dict['Age']
print "dict['School']: ", dict['School']
Output:
dict['Age']:  8
dict['School']:  DPS School

0 Comments:

Popular Posts

Text Widget

Search This Blog

Powered by Blogger.

Blogger Pages

Like Canvas?

Sponsor

Footer Widgetized Areas

About Canvas

About Canvas

Subscribe Us

About

Text Widget

Tags

Total Pageviews

print pdf

cal

Most Popular

    TUPLES
 LIST and SLICING
      ASCII VALUE
Copyright © KTU Btech Cse Python Lab Manuals | Powered by Blogger
Design by Saeed Salam | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates