-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6_exp_loops.py
More file actions
62 lines (46 loc) · 1008 Bytes
/
6_exp_loops.py
File metadata and controls
62 lines (46 loc) · 1008 Bytes
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
#%%
namen_lijst = ['arie', 'jim', 'rose', 'gerard', 'ietje']
#%%
for idx, name in enumerate(namen_lijst):
print(idx)
print(name)
# %%
leeftijden_lijst = [10, 20, 30, 40 , 50]
personen_dict = dict(zip(namen_lijst, leeftijden_lijst))
# %%
personen_dict
# %%
for value in personen_dict.items():
print(value)
# %%
'''
break
continue
pass
'''
#%%
zoek_naam = 'rose'
namen_lijst = ['arie', 'jim', 'rose', 'gerard', 'ietje']
for naam in namen_lijst:
print(naam)
if naam == zoek_naam:
pass
nieuwe_naam = naam.upper()
print(f"{nieuwe_naam}!")
print("De code wordt vervolgd")
# %%
class Car:
pass
# %%
namen_lijst = ['arie', 'jim', 'rose', 'gerard', 'ietje']
upper_namen_lijst = []
for naam in namen_lijst:
print(naam)
upper_namen_lijst.append(naam.upper())
#%%
upper_namen_lijst = [naam.upper() for naam in namen_lijst if naam[0] != "a"]
upper_namen_lijst
# %%
getallen_lijst = [5, 10, 19, 4, 21, 5]
[getal * 2 for getal in getallen_lijst]
# %%