-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdictionary-demo.py
79 lines (66 loc) · 1.69 KB
/
dictionary-demo.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
'''
ogrenciler = {
'120': {
'ad': 'Ali',
'soyad': 'Yılmaz',
'telefon': '532 000 00 01'
},
'125': {
'ad': 'Can',
'soyad': 'Korkmaz',
'telefon': '532 000 00 02'
},
'128': {
'ad': 'Volkan',
'soyad': 'Yükselen',
'telefon': '532 000 00 03'
},
}
1- Bilgileri verilen öğrencileri kullanıcıdan aldığınız bilgilerle
dictionary içinde saklayınız.
2- Öğrenci numarasını kullanıcıdan alıp ilgili öğrenci bilgisini gösterin.
'''
ogrenciler = {}
number = input("öğrenci no: ")
name = input("öğrenci adı: ")
surname = input("öğrenci soyad: ")
phone = input("öğrenci telefon: ")
# ogrenciler[number] = {
# 'ad': name,
# 'soyad': surname,
# 'telefon': phone
# }
ogrenciler.update({
number: {
'ad': name,
'soyad': surname,
'telefon':phone
}
})
number = input("öğrenci no: ")
name = input("öğrenci adı: ")
surname = input("öğrenci soyad: ")
phone = input("öğrenci telefon: ")
ogrenciler.update({
number: {
'ad': name,
'soyad': surname,
'telefon':phone
}
})
number = input("öğrenci no: ")
name = input("öğrenci adı: ")
surname = input("öğrenci soyad: ")
phone = input("öğrenci telefon: ")
ogrenciler.update({
number: {
'ad': name,
'soyad': surname,
'telefon':phone
}
})
print('*'*50)
ogrNo = input('öğrenci no: ')
ogrenci = ogrenciler[ogrNo]
print(ogrenci)
print(f"Aradığınız {ogrNo} nolu öğrencinin adı: {ogrenci['ad']} soyadı: {ogrenci['soyad']} ve telefonu ise {ogrenci['telefon']}")