Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python coding HELP. stuck with how to set up type checking data validation(try/e

ID: 3696166 • Letter: P

Question

Python coding HELP. stuck with how to set up type checking data validation(try/except/finally) and how to format the actual calendar.

Here is the guidelines:

Design, write, and execute a Python language program that asks the user 1.what day of the week their chosen month starts on ("Redday”, "Blueday”, "Greenday", "Yellowday", "Purpleday", "Maroonday", "Orandgeday", "Tanday", and "Silverday"), 2.how many days there are in that month (between 27 and 37), and 3.whether or not it is a Festival month ("yes" or "no"). The program should then display the appropriate Martian calendar for that particular month.

4.Finally, the program should continue asking the user for information about more calendars, and keep displaying

them, until the user indicates that he or she is ready to stop (by answering "yes" or "no" to an
appropriate question). -I have been trying to use a while loop with selective control here but program keeps crashing.

HELP PLEASE!

Explanation / Answer

Here check out the programs for your requirements.

To validate user input:

#How to make sure the user enters a number (integer) - www.101computing.net

def inputNumber(message):
while True:
try:
userInput = int(input(message))   
except ValueError:
print("Not an integer! Try again.")
continue
else:
return userInput
break

#MAIN PROGRAM STARTS HERE:
age = inputNumber("How old are you?")

if (age>=18):
print("You are old enough to vote.")
else:
print("You will be able to vote in " + str(18-age) + " year(s).")

Validating iput number between a range:

Python using while loop to quit if user enters no: consider example