Answer to Question #322627 in Python for lokesh

Question #322627

Multiple of 3:


(1) Input: 6 Output: 3

1 9

2 6

3

5

9

6


(2) Input: 4 Output: 3

1 6

3

6

8


1
Expert's answer
2022-04-03T14:06:33-0400
def fizz_buzz(num):
    if num%3==0 and num%5==0:
        return 'FizzBuzz'

    elif num % 3 == 0:
        return 'Fizz'

    elif num % 5==0:
        return 'Buzz'
    else:
        return num

for n in range(1,100):
    print(fizz_buzz(n))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS