-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathExampleG3.py
More file actions
31 lines (31 loc) · 754 Bytes
/
ExampleG3.py
File metadata and controls
31 lines (31 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'''
n=input("Enter the number: ")
dict={}
dict2={}
for i in range(1,n+1):
dict[i]=i*i
dict2.update({i:i*i})
print dict
print dict2
'''
print "-----------------Staring completely new session-----------------"
#Creating a empty dictionary
data1={}
data2={}
data3={}
data4={}
data5={}
#Creating a dictionary with initial values
data1={'a':1,'b':2,'c':3}
print "Printing data 1========================",data1
data2=dict(a=1,b=2,c=3)
print "Printing data 1========================",data2
data3={k:v for k,v in (('a',1),('b',2),('c',3))}
print "Printing data 1========================",data3
#Inserting/Updating a single value
data1['a']=1
data1.update({'a':1})
data1.update(dict(a=1))
data1.update(a=1)
#Inserting/Updating multiple values
data1.update