-
Notifications
You must be signed in to change notification settings - Fork 0
LC 0412 [E] Fizz Buzz
Code with Senpai edited this page Jun 6, 2022
·
2 revisions
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
nums = list(range(1,n+1))
for i in range(len(nums)):
if nums[i] % 15 == 0:
nums[i] = "FizzBuzz"
elif nums[i] % 3 == 0:
nums[i] = "Fizz"
elif nums[i] % 5 == 0:
nums[i] = "Buzz"
else:
nums[i] = str(nums[i])
return nums
footer