+ 3

Ask for the user's birthdate (dd.mm.yyyy) and print the date with the month in str

input 20/11/1998 output "u were born in november 20 in the year of 1998" My question is: How do i get the part of the string "20/11/1998" to create the variables day = "1st n 2nd 'letters' from the str", month = " 4th n 5th 'letters'" and year = "7th, 8th, 10th n 10th 'letters'"?

9th Sep 2018, 10:12 PM
Fabricio Pavanin
Fabricio Pavanin - avatar
2 Respostas
+ 13
day, month, year = input("Enter birthdate in the format dd/mm/yyyy: ").split("/")
9th Sep 2018, 10:36 PM
Eduardo Petry
Eduardo Petry - avatar
+ 2
yeap, works just fine! Tnks!!!
9th Sep 2018, 10:42 PM
Fabricio Pavanin
Fabricio Pavanin - avatar