import streamlit as st from datetime import datetime, date st.set_page_config(page_title="Age Calculator", page_icon="🎂") st.title("🎂 Age Calculator") st.markdown("Enter your birthdate below to calculate your age:") birthdate = st.date_input( "Select your birthdate", min_value=date(1900, 1, 1), max_value=date.today() ) if st.button("Calculate Age"): today = date.today() age = today.year - birthdate.year - ( (today.month, today.day) < (birthdate.month, birthdate.day) ) st.success(f"Your age is: **{age}** years")