Skip to content

Commit 9924997

Browse files
authored
Add implementation of Day1(FIZZ BUZZ Problem) in py (#333)
* #19 added implementation of Day1(FIZZ BUZZ Problem) in py
1 parent ab8064b commit 9924997

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Day1/Python3/keivalya_FizzBuzz.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'''
2+
*author: keivalya
3+
*date: 25-09-2020
4+
'''
5+
6+
print("******FIZZBUZZ******")
7+
n = int(input("Enter limit for number of digits: "))
8+
9+
for i in range(1, n+1):
10+
final = "" # initialization, for later we can simply append another string to it
11+
if i%3 == 0 :
12+
final = "Fizz" # contition for when divided by 3, remainder is zero
13+
if i%5 == 0:
14+
final += "Buzz" # similar confition for 5
15+
if final :
16+
print(final) # when both conditions satisfy
17+
else:
18+
print(i) # when no condition is satisfied

0 commit comments

Comments
 (0)