ssoni

college.py

Jan 7th, 2026
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import random
  2.  
  3. def apply():
  4.     colleges = {'UF':.15,
  5.                 'Villanova':.3,
  6.                 'BC':.08,
  7.                 'Vanderbilt':.02,
  8.                 'Richmond':.17,
  9.                 'NC State':.65,
  10.                 'Bing':.75,
  11.                 'Stony Brook':.9,
  12.                 'Fordham':.75,
  13.                 'Auburn':.60,
  14.                 'Clemson':.65,
  15.                 'UTK':.55,
  16.                 'Bucknell':.55,
  17.                 'Fairfield':.35}
  18.  
  19.     rejectedFromAll = True
  20.     for c in colleges:
  21.         n = random.random()
  22.         if n <= colleges[c]:
  23.             rejectedFromAll = False
  24.    
  25.     return(rejectedFromAll)
  26.  
  27. def main():
  28.     result = False
  29.     x = 0
  30.     while (result == False):
  31.         result = apply()
  32.         x += 1
  33.         print(x)
  34.  
  35.     print(f'It took {x} students until someone was rejected from all!')
  36.  
  37. main()
  38.  
  39.  
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment