-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12_loops.py
More file actions
47 lines (33 loc) · 814 Bytes
/
12_loops.py
File metadata and controls
47 lines (33 loc) · 814 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
# For loops counting scenario
# for i in range (1,6):
# print(i)
# While loops counting scenario
# i = 1
# while(i <= 5):
# print(i)
# i+=1
# looping in a list using while loop
# list = [1, "rishav" , "batkumar" , "rani" , "5" , False]
# i = 0
# while(i < len(list)):
# print(list[i])
# i+=1
# looping in a list using for loop
# list = [1, "rishav" , "batkumar" , "rani" , "5" , False]
# length = len(list)
# for i in range(0,length):
# print(list[i])
# looping in a tuple using for loop
# t = (4 , 6 , 764 , 293)
# for i in t:
# print(i)
# Iterating through strings using for loop
# s = "Rishav"
# for i in s:
# print(i)
# loop with else statement
l = [1,4,7,3]
for item in l:
print(item)
else:
print("Done")