My Die class rolls ten times and prints a list of results. The solutions manual instead has roll_die return one random number, then calls it ten times outside the class.
My version produces the output I wanted. Is there a reason to prefer the manual's approach?
unlisted-parachute:
So if I wanted to add up the rolls, returning the values would let the rest of the program use them?
x203!idx_58:
Exactly. You can collect the returned numbers in a list and use sum on it, or add each result as you roll.