Python Program To Check Whether A Person Is Senior Citizen Or Not
Last updated June 21, 2023 by Jarvis Silva
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 Code To Check Senior Citizenship
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 code for checking whether a person is senior citizen or not, this program is done by using if else statements where in the if statement we check if the ag is greater or equal to 60 then they are senior citizen if not then they are not senior citizen.
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 or use this online python compiler.
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, 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:
- Python Program To Convert MegaBytes To Bytes.
- Python Program To Convert Miles To Feet.
- Python Program To Convert Rupee To Paise.
- Python Program To Check Whether A Person Is Eligible To Vote Or Not.
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 🙂