Write a program to read a date in the format DD/MM/YYYY and print the same date in MM-DD-YYYY format in python

Code

print("Enter date in format dd/mm/yyyy")
date = input("Enter date: ")
date = date.split("/")
print("Date in format mm-dd-yyyy: %s-%s-%s" % (date[1], date[0], date[2]))

Output