diff --git a/fizzbuzz.py b/fizzbuzz.py index c7f05429500273e1d873ac667a33eb1595054fca..868d5eb64ccef80e67af19c942416a160c18f5d3 100644 --- a/fizzbuzz.py +++ b/fizzbuzz.py @@ -1,18 +1,23 @@ -def fizzbuzz(n:int) -> str: +def fizzbuzz(i:int) -> str: """ Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number And for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". """ - l = [] - for i in range(1:100): - if i % 2 == 0: - l.append ("Fizz") - elif i % 3 == 0: - l.append ("Buzz") - else: - l.append(str(i)) - return l + + if i % 3 == 0 and i % 5 == 0: + s ="FizzBuzz" + + elif i % 3 == 0: + s = "Fizz" + + elif i % 5 == 0: + s ="Buzz" + else: + s = str(i) + + + return s