Feb-04-2019, 10:03 PM
(Feb-04-2019, 09:20 PM)Beginner_coder123 Wrote: number = random.randint(0,len(die)-1)This is the same, and clearer:
number = random.randint(len(die))
But this is even clearer:
number = random.choice(die)
(Feb-04-2019, 09:20 PM)Beginner_coder123 Wrote: ending_conditions = ['stop','Stop','quit','Quit']If you call
.lower()
on the input, you only need ending_conditions = ['stop', 'quit']
. As an added bonus, you also properly handle weird things like "sToP", or "QUIT".(Feb-04-2019, 09:20 PM)Beginner_coder123 Wrote: while end == False:That's kind of gross, and would look nicer as
while not end:
.(Feb-04-2019, 09:20 PM)Beginner_coder123 Wrote: if not(inpu in ending_conditions):I'd prefer to see the "not" next to the "in", like such:
if inpu not in ending_conditions:
The functions
quantitymatrix
and deeper
are the same. One of them can just be deleted, and you can call the other instead.Aside from that, what is it you're trying to refactor?