-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDictionary_.py
79 lines (51 loc) · 1.37 KB
/
Dictionary_.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
dict1 = {"Ankara":6 , "istanbul" : 34}
print(dict1["Ankara"])
print(dict1["istanbul"])
dict1["kocaeli"] = 6
print(dict1)
####
users = {
"gulcihan" : {"age":20, "job": "engineer"},
"cansu" : {"age":24,"job":"dietation"}
}
print(users["gulcihan"])
print(users["cansu"])
print(users["gulcihan"]["age"])
####
students = {
'120' : {"name":"Ali","surname":"Yılmaz","phone":"532 000 00 01"},
'125' : {"name":"Can","surname":"korkmaz","phone":"532 000 00 02"},
'128' : {"name":"Volkan","surname":"Yükselen","phone":"532 000 00 01"}
}
number = input("enter your number :")
name = input("enter your name : ")
surname = input("enter your surname : ")
phone = input("enter your phone :")
#students[number] = {"name":name,"surname":surname,"phone":phone}
#print(students)
students.update({
number : {
"name":name,
"surname":surname,
"phone":phone}
})
print(students)
#you can add a new attribute with using "update"
stdNo = input("no :")
student = students[number]
print(student)
####
# Value types => string , number
x = 10
y = 20
x = y
y= 90
print(x,y) # x=20 , y=90
####
# Reference types
a = ["apple","banana"]
b = ["apple","banana"]
a = b
b[0] = "grape"
# a also changes when we change b because adress of a equal b
print(a,b)