Grafundzijus

Coin flip

Apr 22nd, 2019
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. # Create function that simulates a coin flip. Each time the function is called,
  4. # it should randomly select either heads or tails and print it out.
  5.  
  6. coin_side = ["heads", "tails"]
  7. coin = random.randint(0, 1)
  8. def random_side():
  9. if coin == 0:
  10. print(coin_side[0])
  11. else:
  12. print(coin_side[1])
  13. return
  14.  
  15.  
  16. random_side()
RAW Paste Data