Python Interview Problem : FizzBuzz

Video is ready, Click Here to View ×


Sorry for no background music in this video (Some problem with my video editor).The code :
#Number divisible by 3 = Fizz; Number divisible by 5 = Buzz; Both = FizzBuzz
#This problem will be asked in most of the python job interviews
#Exception Handling

while True:
try:
number = int(input(“Please Enter a number : “))
if number % 3 == 0 and number % 5 == 0:

print (“FizzBuzz”)

break
elif number % 3 == 0:

print (“Fizz”)

Be the first to comment

Leave a Reply

Your email address will not be published.


*