Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Age calculation
#1
Hi,how can we calculate someones age by using python coding? (In the calculation not only the diffrence between years are needed,the months and days should be used too.)

Can someone help me,

Thank You
Kaan
Reply
#2
We are glad to help, but we are not going to do your [home]work for you.
Post your code in python tags, full traceback (if any) - in error tags and ask specific question)s).
For start you may write down how would you solve the problem without computer/script - i.e. step by step, then code each step
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
This is not my homework.Im just trying to learn to do it because I know that oneday I will need to do this
Reply
#4
homework or not - my advise still stands. You need to show effort to solving the problem
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
https://docs.python.org/3/library/datetime.html
https://www.guru99.com/date-time-and-dat...ython.html
  • Create a date object (birthday)
  • Create a date object (today)
  • Calculate the timedelta (today - birthday), then you get the days
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020