Answer to Question #275264 in Python for ricky

Question #275264

Question 2


Write a Python program to check whether a given date is valid date or not and to out put the following.

• If the date is valid then the message “Date is Valid” otherwise the message “Date is Invalid”.

• If the date is a valid date, then the next date.

Hint: Follow the following steps.

(NOTE: You are not allowed to use any Python built-in functions.)

• Get the inputs Year, Month, and Date separately.

• Use selection statements, i.e., if-else statements to check if the Date, Month, and the Year are valid.

• if the date is a valid date, then print the next date (Increment the date).


1
Expert's answer
2021-12-04T01:27:47-0500
date = int(input())
months = int(input())
year = int(input())


if date > 0 and date < 32 and months > 0 and months < 13 and year > 0:
    print(date + 1)
else: print("Invalid date")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS