Explore

Python Programs

Python Program To Check Whether A Person Is Senior Citizen Or Not

Python Program To Check Whether A Person Is Senior Citizen Or Not

In this tutorial we will write a python program to check whether a person is senior citizen or not. To create this program we will use if else statements. In India a person who is 60 and above is considered as senior citizen so we take that criteria as a condition and create this program.

Algorithm To Check Senior Citizen

  • Ask the user to enter their age.
  • Check if age is greater or equal to 60
  • If the above condition is true then print is a senior citizen.
  • If the above condition is false then print not a senior citizen.

As you can see from the above algorithm that it is very simple program so let’s see how to create it in python code.

Python Program To Check Voting Eligibility


age = int(input("Enter you age: "))

if age >= 60:
    print("You are a senior citizen")
else:
    print("You are not a senior citizen")

Above is the python program to check whether a person is senior citizen or not. Now to run this program you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer.

To run this python program, follow the below steps:

  • Create a new folder for this python project.
  • Open it in a code editor of your choice.
  • Create a python file with an ending .py extension.
  • Copy the above code and paste it in your file.
  • Open a terminal or CMD at folder location
  • And type this command python filename.py (Name of your file).

After running this program it will ask you to enter your age and after entering it will check and print if you are a senior citizen or not below is an example output.


Enter you age: 65
You are a senior citizen

As you can see we successfully created this program in python. Don’t want to create all the files and folders then you can run this program now using this online python compiler.

Summary

This was a simple python program to check whether a person is senior citizen or not, I hope you found this tutorial helpful and useful. Do share this tutorial with your friends who might be interested in this program.

Here are some more python program tutorials for you:

I hope you found what you were looking for from this tutorial, and if you want more python programs and tutorials like this, do join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂