Age calculation using python

import datetime

def age_now():
    now_time = str(datetime.date.today())
    split_time = now_time.split("-")
    print("Please enter your date of birth")
    b_year = int(input("Year:"))
    b_month = int(input("Month:"))
    b_day = int(input("Day:"))

    age = int(((int(split_time[0]) * 10000 + int(split_time[1]) * 100 + int(split_time[2])) - (b_year * 10000 + b_month * 100 + b_day)) / 10000)
    print("Current age{}I'm talented".format(age))

age_now()

It's easy like this. I'm using the int function too much and I'm not sure. If you feel like it, try reducing it.

*** Addendum ***

import datetime

def age_now():
    time = str(datetime.date.today())
    now_time = int("".join(time.split("-")))
    print("Please enter your date of birth")
    birthday = int(input())
    age = int(((now_time - birthday) / 10000))
    print("Current age{}I'm talented".format(age))

age_now()

Something like this. Wasn't the input itself easier for the previous guy? Well this time in a place like this ...

Recommended Posts

Age calculation using python
Start using Python
Scraping using Python
Operate Redmine using Python Redmine
Fibonacci sequence using Python
Data analysis using Python 0
Data cleaning using Python
python numpy array calculation
Using Python #external packages
WiringPi-SPI communication using Python
Date calculation in python
Search Twitter using Python
Name identification using python
Notes using Python subprocesses
Date calculation in Python
Try using Tweepy [Python2.7]
Calculation problem using mod
Numerical calculation with Python
Derivatives Learned Using Python-(1) Calculation of Forward Exchange Rate-
Python notes using perl-ternary operator
Flatten using Python yield from
Scraping using Python 3.5 async / await
Save images using python3 requests
Calculation time measurement using maf
Using Quaternion with Python ~ numpy-quaternion ~
Age recognition using Pepper's API
[Python] Calculation method with numpy
Try using Kubernetes Client -Python-
Shapley value calculation in Python
Python notes using perl-special variables
[Python] Using OpenCV with Python (Basic)
Scraping using Python 3.5 Async syntax
Website change monitoring using python
Post to Twitter using Python
Start to Selenium using python
Search algorithm using word2vec [python]
Change python version using pyenv
python: Basics of using scikit-learn ①
Create JIRA tickets using Python
Instrument control using Python [pyvisa]
Manipulate spreadsheets locally using Python
Web scraping using Selenium (Python)
[Python] I tried using OpenPose
[Python] JSON validation using Voluptuous
Broadcast on LINE using python
Data analysis using python pandas
Translate using googletrans in Python
Using Python mode in Processing
Using OpenCV with Python @Mac
[Python] Shooting game using pyxel
Send using Python with Gmail
Calculation of satellite orbit LST using python (true sun, average sun)
Complement python with emacs using company-jedi
Harmonic mean with Python Harmonic mean (using SciPy)
Initializing global variables using Python decorators
[Python] Loading csv files using pandas
GUI programming in Python using Appjar
Retry post request using python requests
[Ubuntu] [Python] Object tracking using dlib
Precautions when using pit in Python
Data acquisition using python googlemap api