dimanche 25 février 2018

conditions and singular output

i = int(input("Enter an integer "))

if i%3 == 0: 
    print('Fizz')

if i%5 == 0:
    print('Buzz')

if i%3 == 0 and i%5 == 0:
    print('Fizz Buzz')

When I enter the integer "15", the program returns "Fizz", "Buzz", and "Fizz Buzz". I'd like to seek some ideas as to how I get the program to return only one output base on the conditions.

No solutions!

Aucun commentaire:

Enregistrer un commentaire