Untitled
unknown
python
a year ago
729 B
8
Indexable
# Online Python - IDE, Editor, Compiler, Interpreter
#import random
import random
mycoin = -1; #coin starts with invalid value
#Get user's input
print("Guess a coin side by entering Heads or Tails.")
myguess = input()
mycoin = random.randint(0, 1); #flip coin
#display what the coin landed on
if (mycoin == 0) : #if landed on heads
if (myguess == "Heads") : #check guess
print("Correct, the coin landed on heads!")
else :
print("Incorrect, the coin landed on heads.")
elif (mycoin == 1) : #if landed on tails
if (myguess == "Tails") :
print("Correct, the coin landed on tails!")
else :
print("Incorrect, the coin landed on tails")
else :
print("Coin hasn't flipped")Editor is loading...
Leave a Comment