Python icon indicating copy to clipboard operation
Python copied to clipboard

β€’πŸ‘¨β€πŸ’»πŸš€πŸprogram to read the name and year of birth of a person. display whether the person is a senior citizen or not #python #Techlearning #vtustudent #codinglife

Open ayyanagoud12 opened this issue 3 months ago β€’ 2 comments

name = input("enter your name: ") year_of_birth = int(input("enter your year_of_birth:"))

from datetime import date current_year = date.today().year age = current_year-year_of_birth

print("/n hello",name)

if age>=60: print("you are senior citizen")

else: print("you are not senior citizen")

ayyanagoud12 avatar Dec 15 '25 15:12 ayyanagoud12

Hi @ayyanagoud12

It's recommended to write your code inside triple backticks to display it better Example:

name = input("enter your name: ")
year_of_birth = int(input("enter your year_of_birth:"))

from datetime import date
current_year = date.today().year
age = current_year-year_of_birth

print("/n hello",name)

if age>=60:
print("you are senior citizen")

else:
print("you are not senior citizen")

Sharmaann avatar Dec 16 '25 10:12 Sharmaann

Senior Citizen Checker Program

πŸš€ Perfect for #vtustudent #codinglife #Techlearning

def check_senior_citizen(): """ Program to read name and year of birth of a person. Displays whether the person is a senior citizen or not. """

# Attractive header with hashtags
print("=" * 60)
print("πŸ‘¨β€πŸ’» SENIOR CITIZEN CHECKER PROGRAM 🐍")
print("=" * 60)
print("πŸš€ Perfect for #vtustudent #codinglife #Techlearning")
print("-" * 60)

try:
    # Get user input
    print("\nπŸ“ ENTER PERSON'S DETAILS:")
    print("-" * 30)
    
    # Read name
    name = input("πŸ‘€ Enter your name: ").strip()
    
    # Read year of birth with validation
    while True:
        try:
            birth_year = int(input("πŸ“… Enter your year of birth (e.g., 1950): "))
            current_year = 2024  # You can update this or get current year dynamically
            
            # Validate year input
            if birth_year < 1900 or birth_year > current_year:
                print(f"⚠️  Please enter a valid year between 1900 and {current_year}")
                continue
                
            break
        except ValueError:
            print("❌ Invalid input! Please enter a valid year (numbers only)")
    
    # Calculate age
    age = current_year - birth_year
    
    # Display results with attractive formatting
    print("\n" + "=" * 60)
    print("πŸ“Š RESULTS")
    print("=" * 60)
    
    print(f"πŸ‘€ Name: {name}")
    print(f"πŸ“… Year of Birth: {birth_year}")
    print(f"πŸŽ‚ Current Age: {age} years")
    
    # Check if senior citizen (typically 60+ years in many countries)
    senior_citizen_age = 60
    
    print("\n" + "-" * 60)
    print("πŸ›οΈ  SENIOR CITIZEN STATUS")
    print("-" * 60)
    
    if age >= senior_citizen_age:
        print(f"βœ… {name}, you ARE a SENIOR CITIZEN! 🌟")
        print(f"   (Age {age} is β‰₯ {senior_citizen_age} years)")
        
        # Additional fun facts
        if age >= 80:
            print("   πŸŽ‰ Extra special status: Octogenarian or above!")
        elif age >= 70:
            print("   πŸŽ‰ Extra special status: Septuagenarian!")
    else:
        years_left = senior_citizen_age - age
        print(f"⏳ {name}, you are NOT a senior citizen yet.")
        print(f"   Only {years_left} more years to go! πŸ’ͺ")
    
    # Display hashtags for social media
    print("\n" + "-" * 60)
    print("πŸ“± Share your result with:")
    print("#python #Techlearning #vtustudent #codinglife #seniorcitizen")
    
    # ASCII art celebration for seniors
    if age >= senior_citizen_age:
        print("\n🎊 CELEBRATION TIME! 🎊")
        print("""   
               .-""-.
              / .--. \\
             / /    \\ \\
             | |    | |
             | |.-"-.|
            ///`.::::.`\\
           ||| ::/  \\:: ;
           ||; ::\__/:: ;
            \\\\ '::::'  /
             `=':-..-'`
        """)
        
except Exception as e:
    print(f"\n❌ An error occurred: {e}")
    print("Please try again!")

Function to get current year dynamically

import datetime def get_current_year(): return datetime.datetime.now().year

Main program execution

if name == "main": # Run the program check_senior_citizen()

# Option to run multiple times
while True:
    print("\n" + "=" * 60)
    run_again = input("\nπŸ”„ Do you want to check another person? (yes/no): ").strip().lower()
    
    if run_again in ['yes', 'y']:
        # Update current year if needed
        check_senior_citizen()
    else:
        print("\n" + "=" * 60)
        print("πŸ‘‹ Thank you for using the Senior Citizen Checker!")
        print("πŸ“š Keep learning! #python #vtustudent #codinglife")
        print("=" * 60)
        break

omkar0072 avatar Dec 19 '25 11:12 omkar0072

Hi, I would like to work on this issue.
I plan to take user input for name and year of birth, calculate age using the current year, and then check if the age is 60 or above to determine senior citizen status.
Please assign this issue to me.

jasneetkr-1610 avatar Jan 05 '26 13:01 jasneetkr-1610