I need help for a Python game I am currently creating. When running the code it will stay open and do nothing after entering a number of times to flip. Here is what I have so far:
# Heads and Tails generator
# User how many times they wish to flip a coin and will recieve the results
CoinTosses = int(input("How many coins do you wish to flip: "))
Heads = 0
Tails = 0
CurrentCoinToss = 0
from random import randint
while CoinTosses != 0:
CurrentCoinToss == int(randint(1, 2))
if CurrentCoinToss == 1:
Heads += 1
CoinTosses -= 1
if CurrentCoinToss == 2:
Tails += 1
CoinTosses -= 1
print("During this round you recieved: ", Heads, " and", Tails, " Tails!")
input("Press the enter key to exit")
What is wrong with this? I have studied my code and nothing SHOULD be wrong.
Change this line
CurrentCoinToss == int(randint(1, 2))
to this
CurrentCoinToss = int(randint(1, 2))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments