Guest User

Untitled

a guest
Sep 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. from random import choice
  2.  
  3. possibilities = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'a', 'b', 'c', 'd', 'e']
  4.  
  5. winning_ticket = []
  6. print("Let's see what the winning ticket is...")
  7.  
  8. # We don't want to repeat winning numbers or letters, so we'll use a
  9. #   while loop.
  10. while len(winning_ticket) < 4:
  11.     pulled_item = choice(possibilities)
  12.  
  13.     # Only add the pulled item to the winning ticket if it hasn't
  14.     #   already been pulled.
  15.     if pulled_item not in winning_ticket:
  16.         print(f"  We pulled a {pulled_item}!")
  17.         winning_ticket.append(pulled_item)
Add Comment
Please, Sign In to add comment