scipiguy

Programming 102: Selecting random teams

Jun 25th, 2019
109
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. left_holding = []
  4. right_holding = []
  5. pens = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet', 'Black', 'White', 'Grey']
  6.  
  7. def add_pen_to_hand(hand):
  8.     pen_picked = choice(pens)
  9.     hand.append(pen_picked)
  10.     pens.remove(pen_picked)
  11.  
  12. repeats = len(pens)
  13. for x in range(int(len(pens)/2)):
  14.     add_pen_to_hand(left_holding)
  15.     add_pen_to_hand(right_holding)
  16.  
  17. print("\nYour left hand is holding these colour pens\n", left_holding)
  18. print("\nYour right hand is holding these colour pens\n", right_holding)
  19. print()
Advertisement
Add Comment
Please, Sign In to add comment