Question: python Write a program to play a version of a three-card game with the computer. Call the file containing your program, playCards.py. Assume that the

python

python Write a program to play a version of a three-card game

with the computer. Call the file containing your program, playCards.py. Assume that

Write a program to play a version of a three-card game with the computer. Call the file containing your program, playCards.py. Assume that the face value and the suit of the each card is represented as follows: Face Value: The numbers 2 to 10 represent the corresponding face value cards (i.e., cards numbered from 2 to 10) 11 represents a Jack 12 represents a Queen 13 represents a King 14 represents an Ace Suit: 1 represents Hearts 2 represents Clubs 3 represents Diamonds 4 represents Spades The game is played against the computer. Your program should ask for the player's first name and then generate 7 random numbers: 3 integers between 2 and 14, inclusive; one for the face value of each of the three cards 3 integers between 1 and 4, inclusive; one for the suit of each of the three cards 1 integer between 7 and 45, inclusive, representing the score for the computer thro cards that have been randomly drawn for the player, plus the Compute the sum of the face value of the three cards that have been randomly drawn for the player, plus the points allocated based on the suit of the cards using the following rules: if all three cards have the same suit then add three points to the sum of the faces value of the three cards if two of the cards have the same suit and the third card has a different suit then add 2 points to the sum of the faces value of the three cards if all three cards have different suits then add 1 point to the sum of the faces value of the three cards Determine and declare the winner (computer, player's name or tied), displaying the computed points for the player and the randomly selected points for the computer.' The output from the program could be as follows: Please enter your first name: Sandy Sandy total is 35 Computer total is 20 Sandy congratulations, you are the winner

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!