View Single Post
Old 02-05-2016, 01:30 AM
Erikvdb Erikvdb is offline
Join Date: May 2013
Posts: 63
I agree with Jeff that we shouldn't fix entire programs here, and there is indeed a lot wrong with your code

The main issue here is that your for loop inside the while loop makes absolutely no sense and your "x <= 3" will never trigger because if x is smaller than 3, it's also smaller than 7.
For a proper random chance calculation (with a given chance), use something like:
if random.random() < 0.7
Or if you want to make sure that it is always going to be exactly 7 out of 10, make a list with 7 "A"s and 3 "B"s, random.shuffle() the list and iterate over that.
Reply With Quote