Created
February 27, 2018 14:22
-
-
Save kmdsbng/39ac9cfffd3bce76108ba25f82e6bb26 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 basic(): | |
| for i in range(1, 101, 1): | |
| cond1 = (i % 3 == 0) | |
| cond2 = (i % 5 == 0) | |
| cond3 = cond1 and cond2 | |
| if cond3: | |
| print(i, 'FizzBuzz') | |
| elif cond2: | |
| print(i, 'Buzz') | |
| elif cond1: | |
| print(i, 'Fizz') | |
| else: | |
| print(i) | |
| def application(): | |
| for i in range(1, 101, 1): | |
| cond1 = (i % 3 == 0) or (str(i).find('3') >= 0) | |
| cond2 = (i % 5 == 0) or (str(i).find('5') >= 0) | |
| cond3 = cond1 and cond2 | |
| if cond3: | |
| print(i, 'FizzBuzz') | |
| elif cond2: | |
| print(i, 'Buzz') | |
| elif cond1: | |
| print(i, 'Fizz') | |
| else: | |
| print(i) | |
| if __name__ == '__main__': | |
| application() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment