summaryrefslogtreecommitdiff
path: root/testing_and_debugging
diff options
context:
space:
mode:
Diffstat (limited to 'testing_and_debugging')
-rw-r--r--testing_and_debugging/gcd.py15
-rw-r--r--testing_and_debugging/script.rst4
-rw-r--r--testing_and_debugging/slides.org2
-rw-r--r--testing_and_debugging/slides.tex2
4 files changed, 12 insertions, 11 deletions
diff --git a/testing_and_debugging/gcd.py b/testing_and_debugging/gcd.py
index b8d1296..5bc9110 100644
--- a/testing_and_debugging/gcd.py
+++ b/testing_and_debugging/gcd.py
@@ -1,10 +1,11 @@
def gcd(a, b):
- if b == 0:
- return a
+ if a%b==0:
+ return a
return gcd(b, a%b)
-if __name__ == '__main__':
- result = gcd(48, 64)
- if result != 16:
- print "Test failed"
- print "Test Passed"
+#if __name__ == '__main__':
+# result = gcd(48, 64)
+# if result != 16:
+# print "Test failed"
+# print "Test Passed"
+
diff --git a/testing_and_debugging/script.rst b/testing_and_debugging/script.rst
index 7a18df9..56b2b8f 100644
--- a/testing_and_debugging/script.rst
+++ b/testing_and_debugging/script.rst
@@ -70,7 +70,7 @@ Open an editor and type the code shown on the slide and save it as gcd.py
{{{ Show slide, gcd function }}}
def gcd(a, b):
- if b == 0:
+ if a % b == 0:
return a
return gcd(b, a%b)
@@ -101,7 +101,7 @@ test case we know that the GCD is 16. So that is the expected output.
{{{ Show slide,Test for gcd.py }}}
def gcd(a, b):
- if b == 0:
+ if a % b == 0:
return a
return gcd(b, a%b)
diff --git a/testing_and_debugging/slides.org b/testing_and_debugging/slides.org
index cb5f7ff..377d689 100644
--- a/testing_and_debugging/slides.org
+++ b/testing_and_debugging/slides.org
@@ -73,7 +73,7 @@ Spoken tutorial on -
- Edit gcd.py file
#+begin_src python
def gcd(a, b):
- if b == 0:
+ if a % b == 0:
return a
return gcd(b, a%b)
diff --git a/testing_and_debugging/slides.tex b/testing_and_debugging/slides.tex
index baa0811..6be2cde 100644
--- a/testing_and_debugging/slides.tex
+++ b/testing_and_debugging/slides.tex
@@ -110,7 +110,7 @@ def gcd(a, b):
\lstset{language=Python}
\begin{lstlisting}
def gcd(a, b):
- if b == 0:
+ if a % b == 0:
return a
return gcd(b, a%b)