Question: How to correct the code? Thanks a lot!! Write a program that draws cards from a deck, and simulates a game of blackjack. First, create
How to correct the code? Thanks a lot!!
Write a program that draws cards from a deck, and simulates a game of blackjack. First, create a class representing a card by filling in the template below. For the value method, Jacks ("J"), Kings ("K"), and Queens("Q") are worth 10, and Aces ("A") should be returned as 1--whether or not an Ace is high (11) or low (1) can be decided by the program that is "playing" blackjack later class Card: def init__(self,suit,rank): self.suit-suit self.rank - rank def value(self): for n in self.rank: if n -"J"or "K" or "Q": elif n"A": s=s+1 else: s - S+ n return s c1 = Card ("Spades", 3) assert c1.value() == 3 Traceback (most recent cal1 last) TypeError ipython-input-28-6fd6612e99bb> in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
