Created
September 23, 2019 11:20
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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