-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion 5.py
More file actions
21 lines (17 loc) · 756 Bytes
/
Question 5.py
File metadata and controls
21 lines (17 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Question : The FizzBuzz Program
# You are given a number and you have to print your answer according to the following:
# If the number is divisible by 3, you print "Fizz" (without quotes)
# If the number is divisible by 5, you print "Buzz" (without quotes)
# If the number is divisible by both 3 and 5, you print "FizzBuzz" (without quotes)
# In any other case, you print the number itself
# Note: You should add a newline character after print() statement.
# Solution :
def fizzBuzz(number):
if number%3==0 and number%5==0:
print("FizzBuzz")
elif number%3==0:
print("Fizz")
elif number%5==0:
print("Buzz")
else:
print(number)