FizzBuzz
Easy
basics
Write a function that returns a list of strings from 1 to n
following these rules:
- For multiples of 3, use
"Fizz"instead of the number. - For multiples of 5, use
"Buzz"instead of the number. - For multiples of both 3 and 5, use
"FizzBuzz". - Otherwise, use the number as a string.
Example:
Input: n = 5
Output: ["1", "2", "Fizz", "4", "Buzz"]
Test Cases
Python Editor
Output
Click "Run" to see results...