Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# This will be filled in with what we output # to the user. action = ' ' # Get the card information from the

# This will be filled in with what we output
# to the user.
action =''
# Get the card information from the user.
color = input('Enter the color of the card: ')
number = int(input('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 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 color == 'Red' and number %2==0:
action = 'Discard 2 cards'
# Card is Red and number is odd
elif color == 'Red' and number %2!=0:
action = 'Draw 1 card'
# Card is Black and number is even
elif color == 'Black' and number %2==0:
action = 'Play another card'
# All other conditions false, card is Black and odd
else:
action = "Skip next player's turn"
print(f'Action: {action}')

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_2

Step: 3

blur-text-image_3

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

proposed system cloud based architecture

Answered: 1 week ago

Question

Which form of proof do you find least persuasive? Why?

Answered: 1 week ago