-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlooptech.py
More file actions
executable file
·39 lines (29 loc) · 1.07 KB
/
looptech.py
File metadata and controls
executable file
·39 lines (29 loc) · 1.07 KB
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
def main():
names = ["Shoukrey", "Harry", "Mohamed", "Mostafa"]
jobs = ["Founder", "Manager", "Co-Founder", "Tester"]
# using foreach technique
# for name in names:
# print(name)
# using for with range
# for i in range(len(names)):
# print(names[i])
# using iter built-in function
# it = iter(names)
# for i in it:
# print(i)
# using enumerate built-in function
# for i, n in enumerate(names, start=1):
# print(i, n)
# using zip built-in function (mostly it's used when combining tow lists)
# for i, m in zip(names, jobs):
# print(i, m)
# using both zip & enumerate
# for i, n in enumerate(zip(names, jobs), start=1):
# print(i, n[0], n[1])
# print list in reversed way using built-in function reversed
# for i, n in enumerate(zip(reversed(names), reversed(jobs)), start=1):
# print(i, n[0], n[1])
# TODO: uncomment all above comments for testing
# NOTE: there still more loop techniques not provided in this file.
if __name__ == '__main__':
main()