aboutsummaryrefslogtreecommitdiffstats
path: root/OLD
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2020-02-18 10:07:23 -0600
committerRossTheRoss <msattr@gmail.com>2020-02-18 10:07:23 -0600
commite71e5db8bf49cce950fe2c22fd7e2c125a25d00d (patch)
tree7bd053b2a31644b26782c434aab94e3700f44e1e /OLD
parentfix things (diff)
downloadhomework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.tar
homework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.tar.gz
homework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.tar.bz2
homework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.tar.lz
homework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.tar.xz
homework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.tar.zst
homework-e71e5db8bf49cce950fe2c22fd7e2c125a25d00d.zip
Fix Collatz problem
Diffstat (limited to '')
-rw-r--r--OLD/ee2301/collatz.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/OLD/ee2301/collatz.py b/OLD/ee2301/collatz.py
index 14873be..5f50ccc 100644
--- a/OLD/ee2301/collatz.py
+++ b/OLD/ee2301/collatz.py
@@ -1,21 +1,21 @@
-def collatzCount(number):
- for n in range (1,number+1):
+def collatzCount(k):
+ for n in range (1,k+1):
collatzConjecture(n)
- #print("\n")
+ print("\n")
def collatzConjecture(n):
- #print(n, end = ' ')
+ print(n, end = ' ')
if n is 1:
return 1
- else:
+ elif n > 1:
if n%2:
return collatzConjecture(int((n*3)+1))
else:
return collatzConjecture(int(n/2))
- raise AssertionError
+ raise AssertionError
try:
- collatzCount(10000)
+ collatzCount(100000)
except AssertionError:
print("The Collatz Conjecture is false!")