Question: I am trying to calculate the number of days between two dates where the user is inputing the dates but cannot find how to do it. I currently have this code:

```
from datetime import date

startdate = date(input("When do you intend to start?"))
enddate = date(input("When is your deadline?"))
numstudydays = enddate - startdate
print (numstudydays)

```

Thank you

Answer: 
In python, `input()` method accepts the input as a string variable. You can then typecast it into an integer using `int()` method. But you cannot typecast an entire tuple. i.e (year, month, day) in your case. 
You can do it by getting all the values one by one. 

```
from datetime import date

print("Enter intended start date details: ")
year = int(input('Year: '))
month = int(input('Month: '))
day = int(input('Day: '))
startdate = date(year, month, day)

print("Enter intended enddate details: ")
year = int(input('Year: '))
month = int(input('Month: '))
day = int(input('Day: '))
enddate = date(year, month, day)
numstudydays = enddate - startdate

print (numstudydays)

```

Hope that helps.
I think your biggest issue is how you retrieve the date.
date() function requires three integers, e.g. date(2017,10,10)

When you use input() you get a string:

```
input()  #returns a string

```

You would also need to solve this by splitting the input somehow:

e.g. 

```
"2017-10-12".split("-") # returns ["2017","10","12"]
[int(i) for i in "2017-10-12".split("-")] # returns [2017,10,12]

```

That means if you do this, you get a date:

```
date(*[int(i) for i in input("When is your deadline?").split("-")])

```

But what you really want in this case is to use strptime. Strptime() converts a string to a datetime by defining how it looks:

```
from datetime import datetime
datetime.strptime("20171012","%Y%m%d").date() # returns: datetime.date(2017, 10, 12)

```

---

**Example of full script**

```
from datetime import datetime

startdate_str = input("When do you intend to start? e.g.(2017-10-10)")
enddate_str = input("When is your deadline? e.g.(2017-10-11)")

startdate_dt = datetime.strptime(startdate_str,"%Y-%m-%d").date()
enddate_dt = datetime.strptime(enddate_str,"%Y-%m-%d").date()

numstudydays = enddate_dt - startdate_dt

print (numstudydays.days) # prints 1 for example inputs

```

**Recommended links**

The various kind of ways to format a string:
<https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>