I was told to rrite a program that asks for and reads in two dates, specified as integers for day and month (two variables for each date). Example 24 and 12 for December 24.
( Write an if-test that tests which date comes first in the same year:
- If the first date comes first, your program should print “Correct order!"
- If the last date entered is an earlier date, the program shall print “Wrong order!”
- If the dates are the same, write "Same date!" out.)
Code
month1 = input("choose a month by writing a number from 1-12!")
month2 = input("choose a month by writing a number from 1-12!")
date1= input("choose a date by writing a number from 1-30!")
date2 = input("choose a date by writing a number from 1-30!")
if month1 > month2:
print("right order! ")
elif month1 < month2:
print("wrong order! ")
if date1 > date2:
print("right order!")
if date1 < date2:
print(" wrong order! ")
elif month1 == month2:
print("same date! ")
elif date1 == date2:
print("same date! ")