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!!How to correct the code? Thanks a lot!! Write a program that

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 () 1 c1 = Card ("Spades", 3) --> 2 assert cl.value ( ) == 3 in value (self) def value (self): >10 for n in self.rank: ifn-= "K" "Q": "J" s=s+10 or or 12 TypeError: 'int' object is not iterable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!