Question: Use the attached shell program and complete the following tasks: 1. Extend the array by including the missing cards. a. Print the completed array. 2.
Use the attached shell program and complete the following tasks: 1. Extend the array by including the missing cards. a. Print the completed array. 2. Print the shuffled array. a. I recommend experimenting with this since random number functions will become very important in the next few assignments. 3. Users should have three chances to guess the correct card. a. I already made these variables for you. 4. Print a message if the user guesses the correct card. 5. calculate how long it took the program to run. a. This is partially completed. b. Use every tool available to you to figure out the solution. 6. Print the number of attempts it took to guess correctly. a. Use the 'lives' and 'tries'. 7. Print a message if the user chose incorrectly. a. Rub salt in the wound, but the words specified in the comment must be present. b. +1 points on Quiz 6 for the most intellectually abrasive comment directed at wrong guesses. 8. If the user cannot guess the correct card after 3 attempts, display "Game Over!!!"
8 8 import datetime #imports datetime library function import math #imports math library function import random #imports the random library function cards = ["2", "Jack", "Queen", "King", "Ace"1#1. extend this array to include the missing cards #print("Unshuffled Cards: ", cards) #test the print statement to make sure your array values are correct def pick_the_right_card(): start_time = datetime.datetime.now () #set the starting time card_selected = input ("Pick a card, any card: ")#this is the card the user will specify random. shuffle (cards) #this uses the random function to shuffle the cards in the array #2. print the shuffled cards #INSERT YOUR CODE HERE lives = 3 tries = 1 #Consider using a while loop here #2. the user should have three chances to choose a card if card_selected cards [0] : #Checks if the user entered value is the card at the top of the deck # 4. print a message if the user chose the correct card, the message should say 'Congratulation, the Heart of the Cards Guides You' #INSERT YOUR CODE HERE print() duration = 999.999999999999! 9999999999 #5. Calculate the duration time that the program takes to run print("You took ", duration," to make a decision. ") #prints the duration it took to guess correctly #6. print the number of attempts the user took to guess correctly #INSERT YOUR CODE HERE #Add code to show the ending time here elif card_selected cards [0]: #modify this if statement #7. Print a message if the user chose incorrectly #INSERT YOUR CODE HERE print() elif lives < 0:#this if statement is correct as is, but you can change it if your implementation deams it necessary #8. if after 3 attempts the user cannot find the card, display "Game Over!!!" pick_the_right_card () #Calls for module
Step by Step Solution
3.43 Rating (156 Votes )
There are 3 Steps involved in it
Answer The code is as follow binbash Define the array representing the deck of cards card... View full answer
Get step-by-step solutions from verified subject matter experts
