From 8e69c6d28682775e621994fec2a3f1caa5258774 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 15:29:56 +0530 Subject: [PATCH 01/13] Fixed challenge 1 --- 01_challenge/01_challenge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_challenge/01_challenge.py b/01_challenge/01_challenge.py index 2d40fa5..f856397 100644 --- a/01_challenge/01_challenge.py +++ b/01_challenge/01_challenge.py @@ -24,7 +24,7 @@ def fizzbuzz(max_num): # % or modulo division gives you the remainder if i%num1==0 and i%num2==0: print(i,three_mul+five_mul) - elif i%num1=0: + elif i%num1==0: print(i,three_mul) elif i%num2==0: print(i,five_mul) From 36f204ccbc9a16ca4c8a9cd69d7ee96de46eb905 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 17:20:52 +0530 Subject: [PATCH 02/13] Error found and fixed --- 02_challenge/02_challenge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02_challenge/02_challenge.py b/02_challenge/02_challenge.py index b41cd50..7513999 100644 --- a/02_challenge/02_challenge.py +++ b/02_challenge/02_challenge.py @@ -23,4 +23,4 @@ def fizzbuzz(max_num): #----START OF SCRIPT if __name__=='__main__': - fizzbuzz() + fizzbuzz(100) From 5789ce1dece22a0d15371515af24768abf024319 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 17:21:28 +0530 Subject: [PATCH 03/13] Error found and fixed --- 02_challenge/02_readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/02_challenge/02_readme.md b/02_challenge/02_readme.md index e69de29..5249c62 100644 --- a/02_challenge/02_readme.md +++ b/02_challenge/02_readme.md @@ -0,0 +1,3 @@ +Error found. +Calling fuction did not pass any arguments as required in fuction definition. +Fixed error by passing 100 integer value as argument to obtain required output. \ No newline at end of file From b35cf81af3f85dd04ad157f5d6d9f9e7f9754352 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 17:33:16 +0530 Subject: [PATCH 04/13] Error found and fixed --- 03_challenge/03_challenge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03_challenge/03_challenge.py b/03_challenge/03_challenge.py index 6e67d1f..7513999 100644 --- a/03_challenge/03_challenge.py +++ b/03_challenge/03_challenge.py @@ -23,4 +23,4 @@ def fizzbuzz(max_num): #----START OF SCRIPT if __name__=='__main__': - fizzbuzz('16') + fizzbuzz(100) From e15c8f0ae2da421fd9908f184b9662f7c279b92a Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 17:33:38 +0530 Subject: [PATCH 05/13] Error found and fixed --- 03_challenge/03_readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/03_challenge/03_readme.md b/03_challenge/03_readme.md index e69de29..74b641b 100644 --- a/03_challenge/03_readme.md +++ b/03_challenge/03_readme.md @@ -0,0 +1,3 @@ +Two errors have been found and fixed:- +1)In fuction definition of fizzbuzz the argument is declared as type int however in the fuction call it has been passed as string type. Removed error by changing int type to string type by removing quotes. +2) In the challange mentioned , program must print outputs up to the range of 99. However 16 has been declared. Hence the value in changed to 100, to ensure a range up to 99. \ No newline at end of file From eddf74cf0ecc598ab6ad4ce90142e9bc372518e7 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 17:45:38 +0530 Subject: [PATCH 06/13] Error found and fixed --- 04_challenge/04_challenge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04_challenge/04_challenge.py b/04_challenge/04_challenge.py index a3f5edf..f856397 100644 --- a/04_challenge/04_challenge.py +++ b/04_challenge/04_challenge.py @@ -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: From 70c023cff9a143f3348d7009499beefd05874a83 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 17:46:21 +0530 Subject: [PATCH 07/13] Error found and fixed --- 04_challenge/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/04_challenge/readme.md b/04_challenge/readme.md index e69de29..7881318 100644 --- a/04_challenge/readme.md +++ b/04_challenge/readme.md @@ -0,0 +1,2 @@ +Error in if else statemants due to wrong indentation. +Once indentation was added the right output was obtained. \ No newline at end of file From 9dcacb4072cf5e5fd393db2e61f38968e7d0135f Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 18:11:58 +0530 Subject: [PATCH 08/13] Error found and fixed --- 05_challenge/05_challenge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/05_challenge/05_challenge.py b/05_challenge/05_challenge.py index 0f9bdbd..e80e03a 100644 --- a/05_challenge/05_challenge.py +++ b/05_challenge/05_challenge.py @@ -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("\\Users\\bilwa\\code\\wtfiswronghere\\05_challenge\\myfile.txt",'r') as f: + print ('i have created') num1 = int(f.readline()) num2=int(f.readline()) max_num = int(f.readline()) From 14a7f0734bfcd16ab3d109c64278984f257e8312 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 18:12:22 +0530 Subject: [PATCH 09/13] Error found and fixed --- 05_challenge/05_readme.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/05_challenge/05_readme.md b/05_challenge/05_readme.md index e69de29..7b6bab1 100644 --- a/05_challenge/05_readme.md +++ b/05_challenge/05_readme.md @@ -0,0 +1,5 @@ +The errors found and how they are fixed:- +1) print stamement did have parenthesis , hence it was not a prper fuction call. By adding parenthesis the argument is passed. +2)File name was entered as mifile.txt insted of myfile.txt +3)Program was unable to locate the file. To resolve this the entire pathname is entered as follows + with open("\\Users\\bilwa\\code\\wtfiswronghere\\05_challenge\\myfile.txt",'r') as f: \ No newline at end of file From 7b245333cc106184b52a54c36ce267fb97d20237 Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 18:19:03 +0530 Subject: [PATCH 10/13] Error found and fixed --- 06_challenge/06_challenge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06_challenge/06_challenge.py b/06_challenge/06_challenge.py index b09e24e..d8d4483 100644 --- a/06_challenge/06_challenge.py +++ b/06_challenge/06_challenge.py @@ -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 From cead12000a1d4ea0214bce4ed76a5b690166fadb Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Tue, 10 Sep 2019 18:19:18 +0530 Subject: [PATCH 11/13] Error found and fixed --- 06_challenge/06_readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/06_challenge/06_readme.md b/06_challenge/06_readme.md index e69de29..4206b79 100644 --- a/06_challenge/06_readme.md +++ b/06_challenge/06_readme.md @@ -0,0 +1,4 @@ +Error found- conf module did not have num as an attribute. +Upon checking the conf module it is seen that it has only 2 attributes num1 and num2. +Hence num has been changed to num2 in the main program. +Required output obtained. \ No newline at end of file From e1497ab41aadcff3037ac861982fc69ab8bab0aa Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Wed, 11 Sep 2019 15:12:30 +0530 Subject: [PATCH 12/13] Error resolved --- 08_challenge/08_challenge.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/08_challenge/08_challenge.py b/08_challenge/08_challenge.py index a7147d2..135caab 100644 --- a/08_challenge/08_challenge.py +++ b/08_challenge/08_challenge.py @@ -11,8 +11,9 @@ class Fizz_Buzz: "Class to implement FizzBuzz for multiples of 3 and 5" - - def fizzbuzz(max_num): + def __init__(self,max_num): + self.max_num=max_num + def fizzbuzz(self): "This method implements FizzBuzz" # adding some redundant declarations on purpose @@ -23,7 +24,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,self.max_num): # % or modulo division gives you the remainder if i%num1==0 and i%num2==0: print(i,three_mul+five_mul) @@ -35,6 +36,6 @@ def fizzbuzz(max_num): #----START OF SCRIPT if __name__=='__main__': "Initialize the fizzbuzz object" - fizzbuzz_obj = Fizz_Buzz() - fizzbuzz_obj.fizzbuzz(100) + fizzbuzz_obj = Fizz_Buzz(100) + fizzbuzz_obj.fizzbuzz() From e806c726f424973e33799f24e7badb1c19da343b Mon Sep 17 00:00:00 2001 From: Bilwa Gutthi Date: Wed, 11 Sep 2019 15:14:34 +0530 Subject: [PATCH 13/13] Error resolved --- 08_challenge/08_readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/08_challenge/08_readme.md b/08_challenge/08_readme.md index e69de29..dfba746 100644 --- a/08_challenge/08_readme.md +++ b/08_challenge/08_readme.md @@ -0,0 +1,2 @@ +Error - number of arguments passed did not match. +Solution- Adding __init__ method and passing arguments in the creation of object. \ No newline at end of file