aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913/lab1
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-09-23 13:03:05 -0500
committerRossTheRoss <msattr@gmail.com>2019-09-23 13:03:05 -0500
commita1c705c5b3024984740138b463553f84edfa0b0b (patch)
tree73049caf54ac2400f946b12e689d47c594e0e110 /csci1913/lab1
parentch-ch-ch-ch-changes (diff)
downloadhomework-a1c705c5b3024984740138b463553f84edfa0b0b.tar
homework-a1c705c5b3024984740138b463553f84edfa0b0b.tar.gz
homework-a1c705c5b3024984740138b463553f84edfa0b0b.tar.bz2
homework-a1c705c5b3024984740138b463553f84edfa0b0b.tar.lz
homework-a1c705c5b3024984740138b463553f84edfa0b0b.tar.xz
homework-a1c705c5b3024984740138b463553f84edfa0b0b.tar.zst
homework-a1c705c5b3024984740138b463553f84edfa0b0b.zip
Final stretches of a bad mess
Diffstat (limited to '')
-rw-r--r--csci1913/lab1/lab2_strap012.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/csci1913/lab1/lab2_strap012.py b/csci1913/lab1/lab2_strap012.py
index 50db0ea..1a9b601 100644
--- a/csci1913/lab1/lab2_strap012.py
+++ b/csci1913/lab1/lab2_strap012.py
@@ -2,23 +2,37 @@ class Zillion:
def __init__(self,digits):
self.digits = digits
self.__x=0
- if digits is not '':
- for __x in range (0,len(digits)):
- try:
- int(digits[__x])
- except ValueError:
- raise RuntimeError
- else:
+ self.List = []
+ self.toList()
+ def toList(self):
+ badBoolean=False
+ if len(self.digits) == 0:
+ raise RuntimeError #Cannot make a list of nothing
+ for n in range (0,len(self.digits)):
+ if self.digits[n] is not ',':
+ if self.digits[n] is not ' ':
+ try:
+ self.List+=[int(self.digits[n])]
+ badBoolean=True
+ except ValueError:
+ raise RuntimeError
+ if badBoolean is False:
raise RuntimeError
+ else:
+ return self.List
def increment(self):
- return int(self.digits)+1
+ return None
def isZero(self):
- for n in range (0,len(self.digits)):
- if str(self.digits)[n] is not '0':
+ for p in range (0,len(self.List)-1):
+ if self.List[p] is not 0 or not '0':
return False
return True
def toString(self):
- return str(self.digits)
+ string=''
+ for q in range (0,len(self.List)):
+ string+=str(self.List[q])
+ return string
+