about | help | code help+videos | done | prefs |
fizzbuzz
Write a function that returns a list of the numbers from 1 up to but not including n. But for numbers that are multiples of three replace the number with "Fizz" and for the multiples of five replace with "Buzz". For numbers which are multiples of both three and five, replace with "FizzBuzz". (FizzBuzz is a child's game, a drinking game, and a well-known test for programming competence.) fizzbuzz(10) → [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz'] fizzbuzz(20) → [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz', 16, 17, 'Fizz', 19] fizzbuzz(1) → [] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 70 Post-solution available
Copyright Nick Parlante 2017 - privacy