Advertisement
Guest User

Untitled

a guest
May 7th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. import random
  2.  
  3. def pick_an_ep(selection=None):
  4.  
  5.   series = {
  6.     'tos': [29, 26, 24],
  7.     'tas': [16, 6],
  8.     'tng': [26, 22, 26, 26, 26, 26, 26],
  9.     'ds9': [20, 26, 26, 26, 26, 26, 26],
  10.     'voy': [16, 26, 26, 26, 26, 26, 26],
  11.     'ent': [26, 26, 24, 22]
  12.   }
  13.  
  14.   if selection in series.keys():
  15.     season = random.randrange(1, 1 + len(series[selection]))
  16.     ep = random.randrange(1, 1 + series[selection][season - 1])
  17.    
  18.   if selection is None:
  19.     selection = random.choice(list(series))
  20.     season = random.randrange(1, 1 + len(series[selection]))
  21.     ep = random.randrange(1, 1 + series[selection][season - 1])
  22.  
  23.   return selection, season, ep
  24.  
  25.  
  26. #specify a series, change string input to desired show
  27. print(pick_an_ep('tng'))
  28.  
  29. #pick from all series
  30. print(pick_an_ep())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement