Home My space log
Language EN (English)

Fizz and Buzz

Python Intermediate alien ages 11-13

The problem

Write a function fizzbuzz(n). It gives back a list for the numbers 1 to n. For each number, put in the text "Fizz" if it divides by 3, "Buzz" if it divides by 5, and "FizzBuzz" if it divides by both. Otherwise put the number as text, like "7".

You will practice: loops, range, if / elif, remainder (%), lists

Mode

Press Tab to indent. Press Esc and then Tab to move on to the next button.

Your code runs in your browser. We do not receive it or save it. Python is downloaded from cdn.jsdelivr.net the first time you run it (about 10 MB).

Test results

      What your code printed