SHARE
TWEET

Coin Toss Exercise

BashBedlam May 24th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import randrange
  2.  
  3. def flip () :
  4.     # Function randomly returns Heads or Tails
  5.     return ('Heads', 'Tails') [randrange (2)]
  6.  
  7. for toss in range (1, 21) :
  8.     print ('Coin toss number {} is {}.'.format (toss, flip ()))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top