Quick help for a python newby, please

Wildman best_lay at yahoo.com
Wed Nov 23 22:41:19 EST 2016


On Thu, 24 Nov 2016 11:59:17 +1100, Chris Angelico wrote:

> On Thu, Nov 24, 2016 at 10:02 AM, Wildman via Python-list
> <python-list at python.org> wrote:
>> Try the code that is below:
>>
>> import datetime
>> from datetime import date
>>
>> today = date.today()
>> person = input("Enter your name: ")
>> byear = raw_input("Enter the four-digit year you were born: ")
> 
> Please take care of Python versions. The OP said Python 3, and you've
> kept one input() call, but then you've used raw_input for the rest.
> These should all be input() calls in Py3.
> 
> ChrisA

Point taken.  I did miss the python3 part.

I switched to raw_input because it handles an empty
input.  An empty input would trigger the ValueError.
No doubt with the correct code the same or similar
could be done with input().  My lack of experience
caused me to look for simpler solution and perhaps
the wrong one.

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!



More information about the Python-list mailing list