Skip to content

Instantly share code, notes, and snippets.

@lucasrizoli
Created January 1, 2023 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasrizoli/e72e4d16eb4c8c69aaa30a202a4e5a0f to your computer and use it in GitHub Desktop.
Save lucasrizoli/e72e4d16eb4c8c69aaa30a202a4e5a0f to your computer and use it in GitHub Desktop.
One-line FizzBuzz in Python 3
# One-line FizzBuzz in Python 3 (for my son, who asked me to show him it was possible)
print("\n".join(["Fizz"*(n%3 == 0) + "Buzz"*(n%5 == 0) or str(n) for n in range(1, 15+1)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment