0
Hello, I am having difficulties in the following code in Python:.
The idea is to create a program that asks for the name and date (year, month and day) of birth of a person.
The program must also request the current date (year, month and day).
On the basis of these dates, it shall determine the age of the person.
Example of a result:
What’s your name? joaquin
What year were you born? 2001
What month were you born in? 2
What day were you born? 23
What year is it? 2018
What month is it? 4
What day is it? 9
Joaquim is 16 years old
The problem is that if a person turns his or her birthday on April 5, 1974 and the current date is January 2, 2018, that person should be 43 years old!
And this is where you’re always giving me 44 years! I don’t know if I made myself clear!??!
The problem is whether a person has his birthday on April 5, 1974 and the current date is January 2, 2018, that person should be 43 years old! And this is where you’re always giving me 44 years! I don’t know if I made myself clear!??!
– Joao Peixoto Fernandes
I edited the answer, check if that way it was clear.
– Paulo Ricardo Freitas Junior
I have an error in the compilation of the code: ================== Exercise 2: age ==================== What’s it called? Joao Was born in what year? 1974 Was born in what month? 4 Was born on what day? 1 Current year? 2018 Current month? 2 Current day? 1 Traceback (Most recent call last): File "python", line 12, in <module> Nameerror: name 'datetime' is not defined
– Joao Peixoto Fernandes
Did you put import datetime at the beginning? the code posted here is normally running here for me
– Paulo Ricardo Freitas Junior
Already gives!! Thanks for the help.
– Joao Peixoto Fernandes