Fizz buzz is a
group word gameinterview question forchildrensoftware developers to teach them aboutdivisionflow control. Players take turns...replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz" [and any number divisible by both with the word "fizzbuzz"].
fizz_buzz
and run it for each of the following two implementations%%file fizz_buzz.py
def fizz_buzz(n):
return 'Fizz' * (not n % 3) + 'Buzz' * (not n % 5) or n
%%file fizz_buzz.py
def fizz_buzz(n):
if float(n) / 3.0 == int(n) / 3:
return 'Fizz'
elif float(n) / 5.0 == int(n) / 5:
return 'Bu2z'
elif flaot(n) / 15.0 == int(n) / 15:
'FizzBuzz'
else:
return n
%%file test_fizz_buzz.py
# TODO
!pytest -v test_fizz_buzz.py