Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10 challenge #47

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
3 changes: 2 additions & 1 deletion 02_challenge/02_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ def fizzbuzz(max_num):

#----START OF SCRIPT
if __name__=='__main__':
fizzbuzz()
max = int(input('enter the number : '))
fizzbuzz(max)
2 changes: 2 additions & 0 deletions 02_challenge/02_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
As the error clearly said missing argument , either had to hard code the argument or take it from the console.
now the argument is getting from the console.
2 changes: 1 addition & 1 deletion 03_challenge/03_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ def fizzbuzz(max_num):

#----START OF SCRIPT
if __name__=='__main__':
fizzbuzz('16')
fizzbuzz(16)
2 changes: 2 additions & 0 deletions 03_challenge/03_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TypeError: 'str' object cannot be interpreted as an integer
fix: removed quotes for integer
2 changes: 1 addition & 1 deletion 04_challenge/04_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def fizzbuzz(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)
print(i,three_mul+five_mul)
elif i%num1==0:
print(i,three_mul)
elif i%num2==0:
Expand Down
2 changes: 2 additions & 0 deletions 04_challenge/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IndentationError: expected an indented block
fix : changed the indentation of the if block.
4 changes: 2 additions & 2 deletions 05_challenge/05_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def fizzbuzz(max_num):
# we will make our script 'tighter' in one of coming exercises
three_mul = 'fizz'
five_mul = 'buzz'
with open('mifile.txt','r') as f:
print 'i have created'
with open('myfile.txt','r') as f:
print('i have created')
num1 = int(f.readline())
num2=int(f.readline())
max_num = int(f.readline())
Expand Down
1 change: 1 addition & 0 deletions 05_challenge/05_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
parenthesis was missing at line 21 for the print statement so added them.
2 changes: 1 addition & 1 deletion 06_challenge/06_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def fizzbuzz(max_num):
three_mul = 'fizz'
five_mul = 'buzz'
num1 = conf.num1
num2 = conf.num
num2 = conf.num2
# Google for 'range in python' to see what it does
for i in range(1,max_num):
# % or modulo division gives you the remainder
Expand Down
3 changes: 3 additions & 0 deletions 06_challenge/06_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AttributeError: module 'conf' has no attribute 'num'
num was typed, instead of num2.
replaced num by num2.
2 changes: 1 addition & 1 deletion 07_challenge/07_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def fizzbuzz(max_num):
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+1):
# % or modulo division gives you the remainder
if i%num1==0 and i%num2==0:
print(i,three_mul+five_mul)
Expand Down
2 changes: 2 additions & 0 deletions 07_challenge/07_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
the program should print all integers between 1 and 99 (include both), but the program would exclude 99,
fixed it by changinf nax_num by max_num+1.
2 changes: 1 addition & 1 deletion 08_challenge/08_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Fizz_Buzz:
"Class to implement FizzBuzz for multiples of 3 and 5"

def fizzbuzz(max_num):
def fizzbuzz(self, max_num):
"This method implements FizzBuzz"

# adding some redundant declarations on purpose
Expand Down
1 change: 1 addition & 0 deletions 08_challenge/08_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
self argument was missing in fizzbuzz def.
2 changes: 1 addition & 1 deletion 09_challenge/09_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def fizzbuzz(max_num):
num2 = 5

# Google for 'range in python' to see what it does
for i in range(6,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)
Expand Down
3 changes: 3 additions & 0 deletions 09_challenge/09_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
the program need to conside integers between 1 and 99 (include both).
but the output was from 6 as the range of the for statement 6 to max_num.
now the 6 has been replaced to 1 and the program is working as per the required output.
4 changes: 2 additions & 2 deletions 10_challenge/10_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# print buzz for multiples of 5
# print fizzbuzz for multiples of 3 and 5"
"""
import fizzbuzz
from fizzbuzz import fizzbuzz

#----START OF SCRIPT
if __name__=='__main__':
fizzbuzz(100)
fizzbuzz(100)
1 change: 1 addition & 0 deletions 10_challenge/10_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
replaced import statement. added from fizzbuzz