Hello people, I’ve been trying to solve this problem for a while trying different options and reasoning them but none worked =( could you pls share the solution?
Given a string called
date that is in the form
MM/DD/YYYY , write a function called
date_extractor that takes
date as an input and returns three values,
day , and
For example, if
date = '6/16/2006' , the function should return
month = 6 ,
day = 16 , and
year = 2006 .
Leave all returned values as strings.
I tried to split the date inside the function using split("/") to get a list. Then I assigned indexes 0 1 and 2 to variables month, day, year. Then I tried to print the results using .format:
It works in pycharm but not in codeacademy. In codeacademy it tells me the following:
Enter a date: Traceback (most recent call last):
- File “script.py”, line 7, in *
- date=input("Enter a date: ")*
EOFError: EOF when reading a line
Also I dont know why I cannot use “return” instead of “print” in this function. WHen I use return, it prints nothing to the console.
Here is the link to the excercise: https://www.codecademy.com/practice/tracks/learn-python-3/modules/learn-python3-strings?redirect_url=%2Flearn%2Flearn-python-3
Thanks a lot !!!