Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 Here's how the actions are determined:
Color Number Action
Red Even Discard cards
Red Odd Draw card
Black Even Play another card
Black Odd Skip next players turn
The instructor has provided a file called LabPFillThisIn.py Download that file and rename it LabPpy
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:
Action: Discard cards
Enter the color of the card: Black
Enter the number on the card:
Action: Skip next player's turn
Enter the color of the card: Red
Enter the number on the card:
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 LabPou#
# James Campbell Jr
# January
# 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 FillThisInEnter the color of the card:
number intFillThisInEnter 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 or number : # 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 :
action 'Discard cards'
# Card is Red and number is odd
elif FillThisIn and FillThisIn:
action 'Draw 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"
printfAction: actionputjpg
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started