For examples
This commit is contained in:
parent
f23f2bd4ac
commit
2682ad2ce5
6 changed files with 27 additions and 0 deletions
4
dict.for.py
Normal file
4
dict.for.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
d = {'Ali': 123, 'Veli': 478, 'Selami': 75, 'Ayşe': 642, 'Fatma': 39}
|
||||
|
||||
for key in d:
|
||||
print(key, '=>', d[key])
|
8
dicts.py
Normal file
8
dicts.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
d = {'Ali': 123, 'Veli': 478, 'Selami': 75, 'Ayşe':642, 'Fatma': 39}
|
||||
k = dict()
|
||||
|
||||
for key in d:
|
||||
k[d[key]] = key
|
||||
|
||||
print(d)
|
||||
print(k)
|
5
for.1.py
Normal file
5
for.1.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
|
||||
for i in a:
|
||||
print(i, end=' ')
|
||||
|
4
for.2.py
Normal file
4
for.2.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
s = {'Ali', 'Veli', 10, 12.4, 'Selami'}
|
||||
|
||||
for x in s:
|
||||
print(x, '=>', type(x))
|
3
s.for.py
Normal file
3
s.for.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
s = 'ankara'
|
||||
|
||||
for c in s: print(c)
|
3
unwrap.py
Normal file
3
unwrap.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
l = [('ali', 123), ('veli', 65), ('selami', 340), ('ayşe', 71)]
|
||||
for name, no in l:
|
||||
print(name, no)
|
Loading…
Reference in a new issue