- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForLoops.py
More file actions
Latest commit
20 lines (16 loc) · 503 Bytes
/
Copy pathForLoops.py
File metadata and controls
20 lines (16 loc) · 503 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
friends= ["Souvik", "Animesh" , "Prince", "Tamoghono"]
#For loop for list
forfriendinfriends:
print(friend)
#For loop using range
forindexinrange(10): #Range gives the list of numbers excluding n where range(n) from 0 to n-1
print(index)
#For loop using len of list
forfriendinrange(len(friends)):
print(friends[friend])
#For loop for some complex logic
forindexinrange(5):
ifindex==0 :
print("First Iteration")
else:
print("Not First Iteration")