I am working on a program that will choose a winner of multiple users and display the winner. I have calculated the percentage number which will be the amount of times the username will be appended to a list.
To clarify:
- Calculate the percentage
- Append the users username to a list the same amount of times as the percentage number.
- Choose a random person from the list.
- Display the winner.
Heres my code so far:
probabilities = []
print("Calculating", player1 + "'s luck!")
time.sleep(3)
player1num = random.randint(0,100)
newnum = player1num / 2
newnumadded = newnum + 10
if newnumadded > 50:
bonusnum = newnumadded + 25
print(player1 + " Your number is:", str(player1num) + "! You have a percentage to win of: ", str(bonusnum) + "%!")
else:
print(player1 + " Your number is:", str(player1num) + "! You have a percentage to win of: ", str(newnumadded) + "%!")
I am trying to make it so that the player1 variable (which is the users name) will be stored inside of the probabilities list the same number of times as the percentage number.
Example: John, has a percentage chance to win of 79%. Add John to the list 79 times