Thread: Classes
View Single Post
Old Apr 29th, 2005, 6:53 AM   #7
Sane
Banned
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,101
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
Adding and removing digits from the right would take just as much multiplication/division with strings as from the left.

Adding digit:
self.txt = int(str(self.txt) + str(random.randrange(0,10)))

Removing digit:
self.txt = int(str(self.txt)[0:len(self.txt)-2])

And why should it matter anyways, if the program really has no point, and digits are generally added and removed from the left. o_O??
Sane is offline   Reply With Quote