-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlooping.py
More file actions
51 lines (33 loc) · 689 Bytes
/
looping.py
File metadata and controls
51 lines (33 loc) · 689 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
import os
import sys
import random
# looping
#for
for x in range(0, 10):
print(x, ' ',end="")
print('\n')
team_list = ['India', 'Mumbai', 'West Indies', 'Shrilanka']
for y in team_list:
print(y)
numlist=[[3,4,5],[33,44,55],[333,444,555]]
for x in range(0,3):
for y in range(0,3):
print(numlist[x][y])
#while
num=0
while(num!=25):
print(num)
num=num+1
#random number
random_num = random.randrange(1,100)
while(random_num!=15):
print(random_num)
random_num=random.randrange(1,100)
# print even numbers
i=0
while(i<100):
if(i%2==0):
print(i,' is even number')
elif(i%1==0):
print(i,' is not even number')
i+=1