aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913
diff options
context:
space:
mode:
authorRossTheRoss <mstrapp@protonmail.com>2019-09-23 18:40:11 -0500
committerRossTheRoss <mstrapp@protonmail.com>2019-09-23 18:40:11 -0500
commit6a3afcfdd556d332d295aed38bec83a9c134cf63 (patch)
tree57c931a510a4292d12149bf0e0a07f597786dc67 /csci1913
parentFinish lab (diff)
downloadhomework-6a3afcfdd556d332d295aed38bec83a9c134cf63.tar
homework-6a3afcfdd556d332d295aed38bec83a9c134cf63.tar.gz
homework-6a3afcfdd556d332d295aed38bec83a9c134cf63.tar.bz2
homework-6a3afcfdd556d332d295aed38bec83a9c134cf63.tar.lz
homework-6a3afcfdd556d332d295aed38bec83a9c134cf63.tar.xz
homework-6a3afcfdd556d332d295aed38bec83a9c134cf63.tar.zst
homework-6a3afcfdd556d332d295aed38bec83a9c134cf63.zip
Format lab gooder
Diffstat (limited to 'csci1913')
-rw-r--r--csci1913/lab1/lab2_strap012.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/csci1913/lab1/lab2_strap012.py b/csci1913/lab1/lab2_strap012.py
index 0aa368b..8c5798e 100644
--- a/csci1913/lab1/lab2_strap012.py
+++ b/csci1913/lab1/lab2_strap012.py
@@ -1,25 +1,27 @@
class Zillion:
def __init__(self,digits):
self.digits = digits
- self.__x=0
self.List = []
self.toList()
+
def toList(self):
badBoolean=False
- if len(self.digits) == 0:
- raise RuntimeError #Cannot make a list of nothing
+ 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:
+ except ValueError: #Non-comma character in string
raise RuntimeError
- if badBoolean is False:
+ if badBoolean is False: #No numbers in string
raise RuntimeError
else:
return self.List
+
+
def increment(self):
length = len(self.List) - 1
newList = self.List
@@ -28,11 +30,13 @@ class Zillion:
for n in range (0,length):
newList[length-n]=0
newList[length-n-1]+=1
+
def isZero(self):
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):
string=''
for q in range (0,len(self.List)):