Quick help for a python newby, please

jones.dayton at gmail.com jones.dayton at gmail.com
Wed Nov 23 09:18:38 EST 2016


I'm just learning, so please excuse my ignorance for what I know is a simple issue...

I'm writing a "Hello, World" type of script to see how things work in python3.  I'm asking for input to get a person's birthday, then I want to compare that to "today" and see how many days have past.

--code--
from datetime import datetime, date

    person = input("Enter your name: ")
    bmonth = int(input("Enter the numerical month you were born: "))
    bday = int(input("Enter the numerical day of the month you were born: "))
    byear = int(input("Enter the year you were born: "))

    today = date.today()
-- end --

I know to get what I want, I need to do something like:
d0 = date(2008, 8, 18)
d1 = date(2008, 9, 26)
delta = d0 - d1
print(delta.days)


but how do I replace the "2008, 8, 18" and "2008, 9, 26" with *my* values?  I've tried several things (which I can't remember all of) but usually end up with an error like this:

   ...
    delta = (b - a)
TypeError: unsupported operand type(s) for -: 'str' and 'str'



More information about the Python-list mailing list