LearnPy Hub
← Comprehensions problems
Medium

FizzBuzz List

Read n and print a list (one comprehension) where each number 1..n is replaced by Fizz if divisible by 3, Buzz by 5, FizzBuzz by both, or kept as a number.

Input

One integer n ≥ 1.

Output

A Python list.

Sample 1

Input
15
Output
[1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz']

Sample 2

Input
1
Output
[1]
solution.py
Output appears here
FizzBuzz List · Python practice problem · LearnPy Hub