I am trying to ask a user:
If they draw an ace, ask if they want it to be 1 or 11. They answer an integer and it is MEANT to set it to either 1 or 11. Unfortunately when I run this stays as the ace.
import time
import random
from random import *
suits = ["Hearts","Diamonds","Clubs","Spades"]
cards = ["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"]
def drawcard():
global newcardtype
global newcardsuit
global newcard
newcardtype = cards[randint(0,11)] ##User interface & Console
newcardsuit = suits[randint(0,3)] ##User interface & Console
newcard = newcardtype, newcardsuit ##Console to read and understand
print("You picked up: " + str(newcardtype) + " of " + str(newcardsuit) + ".")
suits[0] = "♡"
suits[1] = "♢"
suits[2] = "♧"
suits[3] = "♤"
cards[10] = 10
cards[11] = 10
cards[12] = 10
while(True):
test = input("New card? ")
if test == "y":
drawcard()
if newcardtype == cards[0]:
acequestion = int(input("You picked up an Ace. Would you like your Ace to be 1 or 11?: "))
if acequestion == 1:
cards[0] = int(1)
if acequestion == 11:
cards[0] = int(11)
print(newcardtype)
It's in working order, but I want cards[0] which is "ace" to be equal to either 1 or 11 based on the answer to the "acequestion" question.
Aucun commentaire:
Enregistrer un commentaire