Write each card of your shuffled deck to a file named shuffledDeck.dat Read each card in a loop and display the card to the console.

Category: Computer Science

Hello I need help with the following:

•Write each card of your shuffled deck to a file named shuffledDeck.dat

•Read each card in a loop and display the card to the console.

•The user should be able to hit the enter key to see the next card.

•End the loop when all cards have been dealt.

•Allow the user to shuffle again and output or quit the program.

This is the original deck that I used:

import randomsuits = [“clubs”,”diamonds”,”hearts”,”spades”]cards = [“ace”,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9″,”10″,”jack”,”queen”,”king”]deck = []count = 0for suit in range(0,4):    for card in range(0,13):        deck.append(cards[card] + “-” + suits[suit])        print(deck[count])        count = count + 1print(“———————————-“)f = open(“shuffledDeck.dat”,”w”) #opens file with name of “shuffledDeck.dat” whacks any previous file with the “w”for cardIndex in range(0,52):    tempCard = deck[cardIndex]    randomIndex = random.randint(0,51)    deck[cardIndex] = deck[randomIndex]    deck[randomIndex] = tempCardfor cardIndex in range(0,52):    f.write(str(deck[cardIndex]) + “n”)f.close()

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Pay Someone To Write Essay