Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

In what way is output usually harder than input?

Answered: 1 week ago