-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path13_for_loop.py
45 lines (34 loc) · 870 Bytes
/
13_for_loop.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
# for keyword
# for loop syntex:
# for this in that:
# this is in that
# for single_value_of_collection in collection:
# access single value here single_value_of_collection
string_valule = 'Hi Dakhs how are you?'
# i intilize with 0 for showing index number on print in side for loop
# this is this
i = 0
for val in string_valule:
# 0 : H
# 1 : i
print(i, val)
i += 1
biodata = {
'name1': 'Dakhs 1',
'name2': 'Dakhs 2',
'name3': 'Dakhs 3',
'name4': 'Dakhs 4',
'name5': 'Dakhs 5',
'name6': 'Dakhs 6',
'name7': 'Dakhs 7',
'name8': 'Dakhs 8',
}
for key in biodata:
# for key in biodata.values(): items()
print('Name: ', biodata[key])
# print('Name: ', key)
# Name Age ClassName School
for key in biodata:
print(key, biodata[key])
for key, value in biodata.items():
print(key, value)