Question

Write a Python program that reads in the month, day, and year of a date and...

Write a Python program that reads in the month, day, and year of a date and prints it in the
dd/mm/yyyy format or mm/dd/yyyy format, the format depending on the user’s preference. The
program also prints the message
It is a magic date
If the product of month and day is equal to the last two digits of the year. For example, April 20
1980 is a magic date because April (numeric value 4) multiplied by 20 is equal to 80, the last two
digits of 1980. But June 10, 1961 is not a magic date because 6 * 10 is 60, not 61.
The program reads a date in the first three steps given below.
1. The program first prompts for the month. The user enters a value between 1 and 12 (1 for
January, 12 for December, etc.)
2. It then asks for the day of the month. The user enters a value between 1 and 31. We assume
the user enters a day that is consistent with the month and year. For example, if the month is
November, the user will not enter 31.
3. The code then prompts for the year. The user enters the year as a four-digit number.
4. The program then asks the user to enter one of the two strings ddmmyy or mmddyy .
5. The program displays the date it read in in the dd/mm/yyyy format, if the user entered
ddmmyy in Step 4. Otherwise, it prints the date in the other format.
6. The program finally prints the message about the magic date.

```#python code
month=int(input("Enter month:"))
days=int(input("Enter days:"))
year=int(input("Enter year:"))

s=input("Enter ddmmyy for dd/mm/yyyy format or mmddyy for mm/dd/yyyy:")

#add a 0 if month and days are a single digit
if month / 10 < 1:
month = "0" + str(month)
if days / 10 < 1:
days = "0" + str(days)

if s == "ddmmyy":
print(str(days) + "/" + str(month) + "/" + str(year))
else:
print(str(month)+"/"+str(days)+"/"+str(year))

#for magic date
if int(month)*int(days) is year%100:
print("It is a magic date")```

OUTPUT

Earn Coins

Coins can be redeemed for fabulous gifts.