import random Money = 5000 CardValues = [2, 3, 4, 5, 6, 7, 8, 9, 10, "Jack", "Queen", "King", "Ace"] CardSuit = ["Hearts", "Diamonds", "Spades", "Clubs"] Cards = [] for i in CardValues: for j in CardSuit: Cards.append(str(i) + " of " + j) BaseCard1 = random.choice(Cards) BaseCard2 = random.choice(Cards) BaseDealerCard1 = random.choice(Cards) BaseDealerCard2 = random.choice(Cards) print("Your cards are: ") print(BaseCard1) print(BaseCard2) print("The dealer's face up card is: ") print(BaseDealerCard1) YourHand = [] DealersHand = [] BaseCard1.append(YourHand) BaseCard2.append(YourHand) BaseDealerCard1.append(DealersHand) BaseDealerCard2.append(DealersHand) Error message: AttributeError: 'str' object has no attribute 'append' --EDIT: Thank you all so much for the very quick replies and advice on formatting, I am new so constructive criticism is welcome!
submitted by /u/PerfectEconomics7437
[link] [comments]
r/learnpython import random Money = 5000 CardValues = [2, 3, 4, 5, 6, 7, 8, 9, 10, “Jack”, “Queen”, “King”, “Ace”] CardSuit = [“Hearts”, “Diamonds”, “Spades”, “Clubs”] Cards = [] for i in CardValues: for j in CardSuit: Cards.append(str(i) + ” of ” + j) BaseCard1 = random.choice(Cards) BaseCard2 = random.choice(Cards) BaseDealerCard1 = random.choice(Cards) BaseDealerCard2 = random.choice(Cards) print(“Your cards are: “) print(BaseCard1) print(BaseCard2) print(“The dealer’s face up card is: “) print(BaseDealerCard1) YourHand = [] DealersHand = [] BaseCard1.append(YourHand) BaseCard2.append(YourHand) BaseDealerCard1.append(DealersHand) BaseDealerCard2.append(DealersHand) Error message: AttributeError: ‘str’ object has no attribute ‘append’ –EDIT: Thank you all so much for the very quick replies and advice on formatting, I am new so constructive criticism is welcome! submitted by /u/PerfectEconomics7437 [link] [comments]
import random Money = 5000 CardValues = [2, 3, 4, 5, 6, 7, 8, 9, 10, "Jack", "Queen", "King", "Ace"] CardSuit = ["Hearts", "Diamonds", "Spades", "Clubs"] Cards = [] for i in CardValues: for j in CardSuit: Cards.append(str(i) + " of " + j) BaseCard1 = random.choice(Cards) BaseCard2 = random.choice(Cards) BaseDealerCard1 = random.choice(Cards) BaseDealerCard2 = random.choice(Cards) print("Your cards are: ") print(BaseCard1) print(BaseCard2) print("The dealer's face up card is: ") print(BaseDealerCard1) YourHand = [] DealersHand = [] BaseCard1.append(YourHand) BaseCard2.append(YourHand) BaseDealerCard1.append(DealersHand) BaseDealerCard2.append(DealersHand) Error message: AttributeError: 'str' object has no attribute 'append' --EDIT: Thank you all so much for the very quick replies and advice on formatting, I am new so constructive criticism is welcome!
submitted by /u/PerfectEconomics7437
[link] [comments]