mercredi 25 octobre 2017

Python Random Generator

basically i need some quick help. I'm making a program where i am using a 2 random generators to generate numbers. First generator, between 2-14 each number representing a card. Numbers 11, 12 13, and 14 represent Jack, Queen, King & Ace respectively.

Second random generator generating numbers 15-18 to represent the type of card for example 15, 16, 17, 18 would represent Hearts, Spades, Diamonds & Clubs respectively.

What the outcome of the generators should come to is basically lets say generator 1 generated a number 8 and generator 2 generated number 17 i want it to say "8 of Diamonds".

So far my code

import random

Player1 = input("Enter Name Of Player1")
Card = random.randint(2, 14)
Suit = random.randint(15,18)
if Card == 11:
    print("Jack")
elif Card == 12:
    print("Queen")
elif Card == 13:
    print("King")
elif Card == 14:
    print("Ace")
else:
    print(Card)




Aucun commentaire:

Enregistrer un commentaire