Question: Computer Programming PROBLEM 2 In this problem, you are given a partially completed program, and you need to update and fill in the rest of

Computer Programming PROBLEM 2
In this problem, you are given a partially completed program, and you need to update and fill in the rest of the program to produce the desired output.
This program is designed for a card game that determines the action to take based on the color and number of a drawn card. The card color can be red or blue. The card number can be 2-10. Here's how the actions are determined:
Color Number Action
Red Even Discard 2 cards
Red Odd Draw 1 card
Black Even Play another card
Black Odd Skip next players turn
The instructor has provided a file called Lab02P2-FillThisIn.py. Download that file and rename it Lab02P2.py.
Copy that file into your PyCharm project.
Change the program header to include your name and the date.
Replace every instance of "--Fill this in--" with correct code that will enable the program to generate the correct color name for the selected pocket
Sample Outputs:
Enter the color of the card: Red
Enter the number on the card: 4
Action: Discard 2 cards
Enter the color of the card: Black
Enter the number on the card: 5
Action: Skip next player's turn
Enter the color of the card: Red
Enter the number on the card: 12
Action: Card number out of range
Run this program using the PyCharm Terminal.
Take a screenshot of the Terminal that includes the line showing where you started the program run with the results.
Name the screenshot Lab02P2-ou#
# James Campbell Jr
# January 17,2024,
# Card Game Action
#
# All FillThisIn should be replaced with correct code
FillThisIn = None
# This will be filled in with what we output
# to the user.
action =''
# Get the card information from the user.
color = FillThisIn('Enter the color of the card: ')
number = int(FillThisIn('Enter the number on the card: '))
# Determine if the card information is valid.
if color != 'Red' and color != 'Black': # Check if color is correct
action = 'Card color is not valid'
elif number <2 or number >10: # Check if number is out of range
action = 'Card number out of range'
# Card data is valid.
# Determine the action for the card.
else:
# Card is Red and number is even
if FillThisIn and number %2==0:
action = 'Discard 2 cards'
# Card is Red and number is odd
elif FillThisIn and FillThisIn:
action = 'Draw 1 card'
# Card is Black and number is even
elif FillThisIn and FillThisIn:
action = 'Play another card'
# All other conditions false, card is Black and odd
else:
action = "Skip next player's turn"
print(f'Action: {action}')put.jpg.

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!