Sözlük İçlemleri örnekleri
This commit is contained in:
parent
7768f84ed2
commit
824faa026d
4 changed files with 13 additions and 0 deletions
3
python-temel/sozluk.iclemleri.6.py
Normal file
3
python-temel/sozluk.iclemleri.6.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
l = [('ali', 123, 1982), ('veli', 65, 1970), ('selami', 340, 1990), ('ayşe', 71, 1969)]
|
||||
d = {name: (no, year) for name, no, year in l}
|
||||
print(d)
|
3
python-temel/sozluk.iclemleri.7.py
Normal file
3
python-temel/sozluk.iclemleri.7.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
d1 = {'ali': 123, 'veli': 432, 'selami': 892, 'ayşe': 45, 'fatma': 574}
|
||||
d2 = {d1[key]: key for key in d1}
|
||||
print(d2)
|
4
python-temel/sozluk.iclemleri.7.py~
Normal file
4
python-temel/sozluk.iclemleri.7.py~
Normal file
|
@ -0,0 +1,4 @@
|
|||
d1 = {'ali': 123, 'veli': 432, 'selami': 892, 'ayşe': 45, 'fatma': 574}
|
||||
d2 = {d1[key]: key for key in d1}
|
||||
)
|
||||
print(d2
|
3
python-temel/sozluk.iclemleri.8.py
Normal file
3
python-temel/sozluk.iclemleri.8.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
d1 = {'ali': 123, 'veli': 432, 'selami': 892, 'ayşe': 45, 'fatma': 574}
|
||||
d2 = {value: key for key, value in d1.items()}
|
||||
print(d2)
|
Loading…
Reference in a new issue