Skip to content

Instantly share code, notes, and snippets.

@akionsight
Created December 18, 2020 05:42
Show Gist options
  • Save akionsight/7028e5236b23363aa4564fe9c90a6b2a to your computer and use it in GitHub Desktop.
Save akionsight/7028e5236b23363aa4564fe9c90a6b2a to your computer and use it in GitHub Desktop.
A small fizzbuzz using map() in python
## FIZZBUZZ
def fizz_buzz_fizzbuzz(number: int):
if number % 3 == 0 and number % 5 == 0:
return 'FizzBuzz'
elif number % 3 == 0:
return 'Fizz'
elif number % 5 == 0:
return 'Buzz'
else:
return number
numbers_to_100 = [i for i in range(1, 100)]
mapped = map(fizz_buzz_fizzbuzz, numbers_to_100)
res = [print(i) for i in list(mapped)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment