I need help double checking and verifying that my program is correct it needs to follow the following rules. I was able to fix some parts of the code but I continue to get errors. I would greatly appreciate the help
-In cards.py, define a class with the name Card
-Be sure to give it a constructor, it should take in two extra arguments, one for the suite of the card and another for the card's value (numerical). The assignment8.py file is using this yet to be defined constructor of the Card class to populate the Card's initial data.
-Also define a method within the class with the name: get_display_string
-In the get_display_string method, return a string value that will be used to display what Card this is in an easy to read format. As the user, I want to see what suite the card is and if the card's value is over 10, I want the value to be displayed as "Jack", "Queen", "King", "Ace". That is, an 11 will be displayed as "Jack", 12 as "Queen", 13 as "King", and in a special case 1 will be displayed as "Ace" (since there is no "1" card). Values from 2 to 10 can be displayed as a number. I want the suites to be read in some way other than 1, 2, 3, 4; e.g. Clubs, Spades, Hearts, Diamonds.
Program should show this
The dealer opens a new pack of playing cards.
The dealer shuffles.
The dealer pulls five cards from the top.
And we see...
10 of Hearts
Ace of Diamonds
2 of Clubs
2 of Spades
King of Spades
This is the code I have so far
import random
from cards import cards (I am having trouble with this)
def create_deck():
deck = []
for i in range(1, 4+1):
for j in range(1, 13+1):
deck.append(Card(i,j))
return deck
def main():
print('The dealer opens a new pack of playing cards.')
my_deck = create_deck()
print ('The dealer shuffles.')
random.shuffle(my_deck)
print('The dealer shuffles.')
print('And we see...')
for c in my_deck[ :5]:
print('\t' + c.get_display_string())
if __name__ == '__main__':
main()