Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program will allow anywhere between 1 and 6 players (inclusive). Here is what yo

ID: 3795096 • Letter: P

Question

Program will allow anywhere between 1 and 6 players (inclusive). Here is what your output will look like:

Write code in python please

Here are some special cases to consider. If the Dealer goes over 21, all players who are still standing win. But the players that are not standing have already lost. If the Dealer does not go over 21 but stands on say 19 points then all players having points greater than 19 win. All players having points less than 19 lose. All players having points equal to 19 tie.

Code so far:

Explanation / Answer

import random class Card (object): RANKS = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13) SUITS = ('S', 'D', 'H', 'C') def __init__ (self, rank = 12, suit = 'S'): if (rank in Card.RANKS): self.rank = rank else: self.rank = 12 if (suit in Card.SUITS): self.suit = suit else: self.suit = 'S' def __str__ (self): if self.rank == 1: rank = 'A' elif self.rank == 13: rank = 'K' elif self.rank == 12: rank = 'Q' elif self.rank == 11: rank = 'J' else: rank = self.rank return str(rank) + self.suit def __eq__ (self, other): return (self.rank == other.rank) def __ne__ (self, other): return (self.rank != other.rank) def __lt__ (self, other): return (self.rank = other.rank) class Deck (object): def __init__ (self): self.deck = [] for suit in Card.SUITS: for rank in Card.RANKS: card = Card (rank, suit) self.deck.append(card) def shuffle (self): random.shuffle (self.deck) def deal (self): if len(self.deck) == 0: return None else: return self.deck.pop(0) class Player (object): # cards is a list of card objects def __init__ (self, cards): self.cards = cards def hit (self, card): self.cards.append(card) def getPoints (self): count = 0 for card in self.cards: if card.rank > 9: count += 10 elif card.rank == 1: count += 11 else: count += card.rank # deduct 10 if Ace is there and needed as 1 for card in self.cards: if count = 21: break else: break playerPoints.append ((self.Players[i]).getPoints()) # Dealer's turn to hit self.dealer.hit (self.deck) dealerPoints = self.dealer.getPoints() print ('Dealer: ' + self.dealer + ' - ' + str(dealerPoints)) # determine the outcome; you will have to re-write the code # it was written for just one player having playerPoints # do not output result for dealer if dealerPoints > 21: print ('Dealer loses') elif dealerPoints > playerPoints: print ('Dealer wins') elif (dealerPoints