Advertisement
richbpark

deckList1

Jan 28th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. # Detailed Python process to randomize (shuffle) a deck of cards
  2. # Rich Park January 28, 2019
  3.  
  4. import random
  5.  
  6. # Create a card deck list with the face/suit string and numeric intger value
  7. deckList = [('Ace of Spades', 11), ('2 of Spades', 2), ('3 of Spades', 3), \
  8. ('4 of Spades', 4), ('5 of Spades', 5), ('6 of Spades', 6), \
  9. ('7 of Spades', 7), ('8 of Spades', 8), ('9 of Spades', 9), \
  10. ('10 of Spades', 10), ('Jack of Spades', 10), ('Queen of Spades', 10), \
  11. ('King of Spades', 10), ('Ace of Hearts', 11), ('2 of Hearts', 2), \
  12. ('3 of Hearts', 3), ('4 of Hearts', 4), ('5 of Hearts', 5), \
  13. ('6 of Hearts', 6), ('7 of Hearts', 7), ('8 of Hearts', 8), \
  14. ('9 of Hearts', 9), ('10 of Hearts', 10), ('Jack of Hearts', 10), \
  15. ('Queen of Hearts', 10), ('King of Hearts', 10), ('Ace of Clubs', 11), \
  16. ('2 of Clubs', 2), ('3 of Clubs', 3), ('4 of Clubs', 4), \
  17. ('5 of Clubs', 5), ('6 of Clubs', 6), ('7 of Clubs', 7), ('8 of Clubs', 8), \
  18. ('9 of Clubs', 9), ('10 of Clubs', 10), ('Jack of Clubs', 10), \
  19. ('Queen of Clubs', 10), ('King of Clubs', 10), ('Ace of Diamonds', 11), \
  20. ('2 of Diamonds', 2), ('3 of Diamonds', 3), ('4 of Diamonds', 4), \
  21. ('5 of Diamonds', 5), ('6 of Diamonds', 6), ('7 of Diamonds', 7), \
  22. ('8 of Diamonds', 8), ('9 of Diamonds', 9), ('10 of Diamonds', 10), \
  23. ('Jack of Diamonds', 10), ('Queen of Diamonds', 10), ('King of Diamonds', 10)]
  24.  
  25. # Print the deck list
  26. print('Print the straight deck.\n')
  27. print(deckList,'\n')
  28.  
  29. # List the deck list
  30. i=0
  31. print('Print the straight deck as an itemized list.\n')
  32. for item in deckList:
  33. i+=1
  34. print (i,' ',item)
  35.  
  36. print('\n\n') # Two blank lines
  37.  
  38. # Create a random deck list
  39. random.shuffle(deckList)
  40. #print the randomly shuffled deck list
  41. print('Print the random deck.\n')
  42. print(deckList,'\n')
  43. # List the random deck list
  44. i=0
  45. print('Print the random deck as an itemized list.\n')
  46. for item in deckList:
  47. i+=1
  48. print (i,' ',item)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement