The Fizzbuzz problem is a classic one for coding interviews. The problem goes as follows:
Given a whole number n greater than 0, return a list of all numbers up to n (inclusive), replacing multiples of 3 with Fizz, multiples of 5 with Buzz, and multiples of both with Fizzbuzz.
For example, if n = 20, we want to return:
>> [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'Fizzbuzz', 16, 17, 'Fizz', 19, 'Buzz']
The construction of the logic is fairly straightforward. Being a multiple of both 3 and 5 means that the number must be a multiple of 15. We use this as our first condition in a series of if statements.
Below is my solution in Python.