(Game: heads or tails) Write a program that lets the user guess whether a flipped coin displays the head or the tail. The program randomly generates an integer 0 or 1, which represents head or tail. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect.
SOURCE CODE:
import random
a = random.randint(0, 1)
head = 0
tail = 1
# Enter guess whether it is head or tail
answer = eval(input("Enter the guess:"))
# Checking your guess is correct or wrong
if a == answer:
print("You are correct")
else:
print("You are wrong")
OUTPUT:
Enter the guess:0
You are wrong