diff --git a/11_challenge/11_challenge.py b/11_challenge/11_challenge.py index 123d406..c9edcb3 100644 --- a/11_challenge/11_challenge.py +++ b/11_challenge/11_challenge.py @@ -14,12 +14,13 @@ def fizzbuzz(max_num): # Google for 'range in python' to see what it does for i in range(1,max_num): # % or modulo division gives you the remainder - if i%3==0: + if (i%3==0 and i%5==0): + print(i,"fizzbuzz") + elif (i%3==0): print(i,"fizz") - elif i%5==0: + elif (i%5==0): print(i,"Buzz") - elif i%3==0 and i%5==0: - print(i,"fizzbuzz") + #----START OF SCRIPT if __name__=='__main__': diff --git a/13_challenge/13_challenge.py b/13_challenge/13_challenge.py index e7828f6..f856397 100644 --- a/13_challenge/13_challenge.py +++ b/13_challenge/13_challenge.py @@ -14,13 +14,13 @@ def fizzbuzz(max_num): # adding some redundant declarations on purpose # we will make our script 'tighter' in one of coming exercises - three_mul = 'fizz + three_mul = 'fizz' five_mul = 'buzz' num1 = 3 num2 = 5 # Google for 'range in python' to see what it does - for i in range(1,max_num) + for i in range(1,max_num): # % or modulo division gives you the remainder if i%num1==0 and i%num2==0: print(i,three_mul+five_mul) @@ -31,4 +31,4 @@ def fizzbuzz(max_num): #----START OF SCRIPT if __name__=='__main__': - fizzbuzzy(100) + fizzbuzz(100)