[Tutor] Help with a funcion

Laura Schramm laura.schramm92 at gmail.com
Mon Dec 30 07:09:26 EST 2019


Hello,
I was hoping you could help me out creating a function.

My professor has requested that I create a function that simulates m throws
of a dice with n sides. The function should return a list of tuples with
(value_side, percentage) for every side. The percentages should be
expressed as a chain of text with a decimal and "%".

For example: For 1000 throws of a dice with 4 sides the answer should look
like
[(1, 25.3%), (2, 25.8%), (3, 25.0%), (4, 24.5%)]

I am given the prompt
def throws_of_dice(n_sides, n_throws)

Any help would be greatly appreciated.

Thank you!

- Laura Schramm


More information about the Tutor mailing list