I am trying to write a program that flips a coin, and displays Heads or Tails accordingly. This is what I have:
from random import random
while True:
for i in range (2):
spin = i.random()
if spin == 0:
print ("Heads")
else:
print ("Tails")
but I keep getting the error:
Traceback (most recent call last):
File "C:/Users/Yamnel/Desktop/Python Programs/coin flip.py", line 5, in <module>
spin = i.random()
AttributeError: 'int' object has no attribute 'random'