vendredi 29 avril 2016

Randomising a list with values

Create a program that will generate a random card and then ask the user to go Higher, Lower or Quit. If the player chooses Higher the next card must be of a higher value or the player is out. Likewise for Lower. So far I have something that just produces a random card

import random
Suits = ["Hearts", "Diamonds", "Clubs", "Spades"]
Cards =     ["Ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",     "Jack", "Queen", "King"]
print(random.choice(Suits))
print(random.choice(Cards))




Aucun commentaire:

Enregistrer un commentaire