more fore examples
This commit is contained in:
parent
1d368de073
commit
15ed46213a
3 changed files with 15 additions and 0 deletions
4
for.dict.py
Normal file
4
for.dict.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
d = {'ali': 123, 'veli': 765, 'selami': 745, 'ayşe': 271, 'fatma': 754}
|
||||
|
||||
for key, value in d.items():
|
||||
print(key, value)
|
8
for.tuple.2.py
Normal file
8
for.tuple.2.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
a = [('ali', 10), ('veli', 20), ('selami', 30), ('ayşe', 40), ('fatma', 50)]
|
||||
b = []
|
||||
|
||||
for name, no in a:
|
||||
b.append((no, name))
|
||||
|
||||
print(a)
|
||||
print(b)
|
3
range.for.py
Normal file
3
range.for.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
for i in range(1, 10):
|
||||
print(i, end=' ')
|
||||
print()
|
Loading…
Reference in a new issue