tzoonami

Untitled

Dec 2nd, 2020
762
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import randint
  2.  
  3.  
  4. def allOnes():
  5.     evelynscore = randint(1,20)
  6.     taylorscore = randint(1,20)
  7.     beeposcore = randint(1,20)
  8.     if taylorscore == evelynscore and taylorscore == beeposcore:
  9.         return allOnes()
  10.     else:
  11.         if taylorscore == evelynscore:
  12.             if taylorscore > beeposcore:
  13.                 return doTrial()
  14.             else:
  15.                 return False
  16.         if taylorscore == beeposcore:
  17.             if taylorscore > evelynscore:
  18.                 return doTrial()
  19.             else:
  20.                 return False
  21.         return taylorscore > evelynscore and taylorscore > beeposcore
  22.    
  23.  
  24.  
  25. def doTrial():
  26.     evelynscore = randint(1,20)
  27.     taylorscore = randint(1,20)
  28.     if taylorscore == evelynscore:
  29.         if taylorscore == 1:
  30.             return allOnes()
  31.         else:
  32.             return doTrial()
  33.     else:
  34.         return taylorscore > evelynscore
  35.            
  36.            
  37.  
  38.  
  39. if __name__ == "__main__":
  40.     numtrials = 100000000
  41.     taylorwins = 0
  42.     for i in range(numtrials):
  43.         if i % (numtrials/10) == 0:
  44.             print( (i*100)/numtrials, "%")
  45.         if doTrial():
  46.             taylorwins +=1
  47.     print("Taylor won", taylorwins, "out of", numtrials, "trials")
  48.        
  49.                
  50.            
  51.  
RAW Paste Data