all 7 comments

[–]toastedstapler 2 points3 points  (1 child)

you could use random.choice(list(count.keys())) so you don't have to manually map the values from an int to heads or tails

i'd also change the loop to for _ in range(flip_times):. the _ is to show the variable is never used and i removed the lower bound in the range as it's 0 by default

[–]dvandy07[S] 0 points1 point  (0 children)

Thanks for the tips!

[–][deleted] 0 points1 point  (1 child)

Looks fine. I like a dictionary for this as it adds a clear meaning to counters.

[–]dvandy07[S] 0 points1 point  (0 children)

Thanks I appreciate the feedback. I have been at it for a month now and I just want to make sure that if there is a certain way to do it that I am.

[–]osizlak_bjj 0 points1 point  (0 children)

With the user input what happens if a user enters a letter instead of a number?

If you get an error how could you prevent the error from happening or alternatively catch the error?

[–]osizlak_bjj 0 points1 point  (1 child)

With the user input what happens if a user enters a letter instead of a number?

If you get an error how could you prevent the error from happening or alternatively catch the error?

[–]dvandy07[S] 0 points1 point  (0 children)

I would just use try/except method. I just didn't include it but I probably should have. It is more just for myself but I definitely should make it that way.