Skip to content

Instantly share code, notes, and snippets.

@ottergauze
Created September 23, 2019 11:20
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 ottergauze/8dd56c1a64510d85538bd825cc08e31a to your computer and use it in GitHub Desktop.
Save ottergauze/8dd56c1a64510d85538bd825cc08e31a to your computer and use it in GitHub Desktop.
A quick simple programming in Python exercise. - I haven't used python properly in quite some time.
def fizzbuzzswitch(x, i):
return {
1: "Fizz",
2: "Buzz",
3: "FizzBuzz"
}.get(x, i)
for i in range(1,101):
condition = 0
if i % 3 == 0:
condition = 1
if i % 5 == 0:
condition = 2
if i % 3 == 0 and i % 5 == 0:
condition = 3
print(str(fizzbuzzswitch(condition, i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment