I am VERY new to Python (2 weeks in!) and was trying a random test of things I've learned so far (basics with if statements, print commands, etc.) I'm sure there's a better way to do what I'm trying to do, but for now I don't know classes, dictionaries or other techniques that might be helpful. I'm basically trying to create a deck of cards using a random number generator, but when the number is an 11 through a 14 I would like it to display a text string ("J", "Q" for example). What I'm finding is that it doesn't seem to be working for any numbers above 10. I set up the "while" loop, but that was just for testing purposes so I could run multiple iterations at once and see if it was ever resulting in face cards. Can somebody help me with what I'm doing wrong? Again...I'm just a novice, so I very much appreciate the help. Code below!
#Mechanics for random card draw
import random
def deal():
n=5
while n>0:
dealer = random.randint(2,14)
playercard = random.randint(2,14)
if dealer == 14:
displaydealer = "A"
elif dealer == 13:
displaydealer = "K"
elif dealer == 12:
displaydealer = "Q"
elif dealer == 11:
displaydealer = "J"
else:
displaydealer = dealer
print(displaydealer)
if playercard == 14:
displayplayercard = "A"
elif playercard == 13:
displayplayercard = "K"
elif playercard == 12:
displayplayercard = "Q"
elif playercard == 11:
displayplayercard = "J"
else:
displayplayercard = playercard
print(displayplayercard)
n = n-1NOTE: I don't know how to make indentations show up in my thread, but it is indented properly in my text editor. I could use help there too!
