teromakotero icon

Coin flip

teromakotero | PRO | 05/05/19 09:52:52 AM UTC | 0 ⭐ | 375 👁️ | Never ⏰ | []
Python |

330 B

|

None

|

0 👍

/

0 👎

'''
Create function that simulates a coin flip. Each time the function is called, it should randomly select 
either heads or tails and print it out.
'''
import random
 
def coin_flip():
    heads_tails = random.randint(0,1)
    if(heads_tails == 0):
        print("heads")
    else:
        print("tails")
        
coin_flip()

Comments