Answer: Dear student, Kindly find the code, i think after seeing this code your issues will be solved. You didn't mention full question means what you want in program i think that you want a program that prompts for month and add a number in this to find preceding month and print out the preceding month. This porgram is doing the same. you have to assign numbers for each variable in new line. If you have any queries , feel free to ask me. Thanks.
month = int(input("Enter the month:"))
january = 1
february = 2
march = 3
april = 4
may = 5
june = 6
july = 7
august = 8
september = 9
october = 10
november = 11
december = 12
precedingMonth = month+1
if precedingMonth == 2:
print("The preceding month is-February")
elif precedingMonth == 3:
print("The preceding month is-March")
elif precedingMonth == 4:
print("The preceding month is-April")
elif precedingMonth == 5:
print("The preceding month is-May")
elif precedingMonth == 6:
print("The preceding month is-June")
elif precedingMonth == 7:
print("The preceding month is-July")
elif precedingMonth == 8:
print("The preceding month is-August")
elif precedingMonth == 9:
print("The preceding month is-September")
elif precedingMonth == 10:
print("The preceding month is-October")
elif precedingMonth == 11:
print("The preceding month is-November")
elif precedingMonth == 12:
print("The preceding month is-December")
Get Answers For Free
Most questions answered within 1 hours.