Still having no luck with some tutors answering my question. I have attached the
ID: 3696826 • Letter: S
Question
Still having no luck with some tutors answering my question. I have attached the images of what the program should entail.
Here is my original question:
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
I am able to do the following in the given time
contuloop = 1
mdays = ["Redday", "Blueday", "Greenday", "Yellowday", "Purpleday", "Maroonday", "Orandgeday", "Tanday", "Silverday"]
festiveDays = ["Maroonday", "Orandgeday", "Tanday", "Silverday"]
startDay = "Redday"
noOfDays = 27
isFestival = "no"
while(contuloop == 1):
startDay = input("Enter the starting day of the month:")
noOfDaysStr = input("Enter the number of days in the month(27 to 34):")
noOfDays = int(noOfDaysStr)
isFestival = input("is this festival month(yes/no)?:")
print("Martian calendar for month starting on ",startDay,", with ",noOfDays," days")
print(" R B G Y P M O T S")
mcalendar = ""
displayDay = 1
for i in range(1, noOfDays+1):
if(i == 1):
if(isFestival == "yes"):
startDay = mdays[0]
displayDay = 0
for day in mdays :
displayDay = displayDay + 1
if(startDay == day):
mcalendar = mcalendar + " 1"
break;
else:
mcalendar = mcalendar + " "
else:
curDay = displayDay%9
curDay = curDay +1
if(isFestival == "yes" and curDay>= 6 and curDay <= 9):
mcalendar = mcalendar + " "
displayDay = displayDay +1
for fday in festiveDays:
mcalendar = mcalendar + " "
if (displayDay % 9 == 0):
mcalendar = mcalendar + " "
displayDay = displayDay +1
else:
displayDay = displayDay +1
if(i >= 10):
mcalendar = mcalendar + " "+str(i)
else:
mcalendar = mcalendar + " "+str(i)
if (displayDay % 9 == 0):
mcalendar = mcalendar + " "
print(mcalendar)
--output-----------
Enter the starting day of the month:Redday
Enter the number of days in the month(27 to 34):28
is this festival month(yes/no)?:no
Martian calendar for month starting on Redday , with 28 days
R B G Y P M O T S
1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
28
Enter the starting day of the month:Redday
Enter the number of days in the month(27 to 34):28
is this festival month(yes/no)?:yes
Martian calendar for month starting on Redday , with 28 days
R B G Y P M O T S
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27 28
Enter the starting day of the month:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.