Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pseudocode for the following # Function: This program determines if a date entered by the user is valid. # Input: Interactive # Output: Valid date

pseudocode for the following
# Function: This program determines if a date entered by the user is valid.
# Input: Interactive
# Output: Valid date is printed or user is alerted that an invalid date was entered.
validDate = True
MIN_YEAR =0
MIN_MONTH =1
MAX_MONTH =12
MIN_DAY =1
MAX_DAY =31
# Get the year, then the month, then the day
year = int(input("Enter the year: "))
month = int(input("Enter the month (1-12): "))
day = int(input("Enter the day (1-31): "))
# Check to be sure date is valid
if year <= MIN_YEAR: # invalid year
validDate = False
elif month < MIN_MONTH or month > MAX_MONTH: # invalid month
validDate = False
elif day < MIN_DAY or day > MAX_DAY: # invalid day
validDate = False
# Test to see if date is valid and output date and whether it is valid or not
if validDate:
print(f"{month}/{day}/{year} is a valid date.")
else:
print(f"{month}/{day}/{year} is an invalid date.")

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

The numbers of participants in the study.

Answered: 1 week ago