-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathsolution.py
More file actions
42 lines (36 loc) · 897 Bytes
/
solution.py
File metadata and controls
42 lines (36 loc) · 897 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
# Solution of day1 task3
# Generating even and odd numbers with for loop
print('Generating Odd and Even numbers exerice with For loop!')
even=[]
odd=[]
for i in range(1,11):
if(i%2==0):
even.append(i)
else:
odd.append(i)
print("The even numbers are: ", even)
print("The odd numbers are: ", odd)
# Generating even and odd numbers with while loop
print('Generating Odd and Even numbers exerice with while loop!')
even=[]
odd=[]
i = 1
while i <= 11:
if(i%2==0):
even.append(i)
else:
odd.append(i)
i += 1
print("The even numbers are: ", even)
print("The odd numbers are: ", odd)
# Fizz Buzz Exercice
print('Welcome to Fizz Buzz exerice!')
for i in range(1,101):
if i % 3 ==0 and i % 5 == 0:
print(i, "FizzBuzz")
elif i % 3 == 0:
print(i, "Fizz")
elif i % 5 == 0:
print(i, "Buzz")
else:
print(i)