Jul-16-2017, 09:51 PM
Something like that?
victor ~ $ ptpython >>> import random, datetime >>> months = {datetime.date(2017, month, 1).strftime('%B'): month for month in range(1, 13)} >>> carousel = iter(months) >>> num = months[random.choice(list(months.keys()))] >>> for i in range(num - 1): ... next(carousel) >>> while True: ... try: ... print(months[next(carousel)]) ... except StopIteration: ... break 10 11 12