diff --git a/fizzbuzz.py b/fizzbuzz.py index 12dfa151fe608ca5f0d4b307f8c7b0c3528eb09b..006f77636b887075c4a8e96577b0a0e2fb87d9a9 100644 --- a/fizzbuzz.py +++ b/fizzbuzz.py @@ -5,13 +5,13 @@ def fizzbuzz(n:int) -> str: And for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". """ - for i in range(1,101): - if i%3==0 and not i%5==0: - print ("Fizz") - if i%5 and not i%3==0: - print ("Buzz") - if i%3==0 and i%5==0: - print ("FizzBuzz") + + if n%3==0: + return ("Fizz") + if n%5==0: + return ("Buzz") + if n%3==0 and i%5==0: + return ("FizzBuzz") - return "" + return str(n)