Check whether the given citizen is a senior citizen

In this python if else program, we will check whether the given citizen is a senior citizen or not depending on the age.

Condition:
If the age is greater than 60 then the person is a Senior Citizen.

Steps to solve the program
  1. Take the age of a citizen as input through the user.
  2. Using an if-else statement determine whether the citizen is a senior citizen or not.
  3. If the age is greater than 60 then only the citizen is a senior citizen.
  4. Print the output.
				
					age = int(input("Enter age of a citizen: "))

if age > 60:
    print("The given citizen is a senior citizen")
else:
    print("The given citizen is not a senior citizen")
				
			

Output :

				
					Enter age of a citizen: 70
The given citizen is a senior citizen
				
			

Related Articles

accept the city name and display its monuments

find the lowest number between three numbers.

Accept the city name and display its monuments

In this python if else program, we will accept the city name and display its monuments take Pune and Mumbai as cities.

Steps to solve the program
  1. Take a city as input through the user.
  2. Using an if-else statement print any 3 monuments of the respective city.
				
					city = input("Enter city name: ").lower()

if city == "pune":
    print("Shaniwar vada\nLal mahal\nSinhgad fort")
elif city == "mumbai":
    print("Getway of India\nGandhi statue\nAjanta cave")
else:
    print("Invalid city")
				
			

Output :

				
					Enter city name: pune
Shaniwar vada
Lal mahal
Sinhgad fort
				
			

Related Articles

take input from the user between 1 to 7 and print the day according to the number.

check whether the citizen is a senior citizen or not.

Take input from the user print the day according to the number.

In this python if else program, we will take input from the user between 1 to 7 and print the day according to the number.

Criteria:
1 – Sunday
2- Monday
3 – Tuesday
4 – Wednesday
5 – Thursday
6 – Friday
7 – Saturday

Steps to solve the program
  1. Take a number between 1-7 as input.
  2. Using if-else statements print the day according to the number (i.e. 1-Sunday, 2-Monday,….,7-Saturday)
				
					num = int(input("Enter a number: "))

if num == 1:
    print("Sunday")
elif num == 2:
    print("Monday")
elif num == 3:
    print("Tuesday")
elif num == 4:
    print("Wednesday")
elif num == 5:
    print("Thursday")
elif num == 6:
    print("Friday")
elif num == 7:
    print("Saturday")
else:
    print("Invalid number")
				
			

Output :

				
					Enter a number: 5
Thursday
				
			

Related Articles

accept the car price of a car and display the road tax to be paid

accept the city name and display its monuments

Accept the car price and display the road tax to be paid

In this python if else program, we will accept the car price of a car and display the road tax to be paid depending on the car price.

Steps to solve the program
  1. Take the car price as input through the user.
  2. Using if-else statements print the tax to be paid depending on the car price.
  3. Use the criteria given in the question to find the tax amount.
				
					amount = int(input("Enter car price: "))

if amount <= 500000:
    print("Tax payable: ",15000)
elif 500000 < amount <= 1000000:
    print("Tax payable: ",50000)
else:
    print("Tax payable: ",80000)
				
			

Output :

				
					Enter car price: 1200000
Tax payable:  80000
				
			

Related Articles

display 1/0 if the user gives Hello/Bye as output.

take input from the user between 1 to 7 and print the day according to the number.

Program to display 1/0 if the user gives Hello/Bye as output.

In this python if else program, we will display 1/0 if the user gives Hello/Bye as output.

Steps to solve the program
  1. Take input through the user.
  2. Using an if-else statement display 1/0 if the user gives Hello/Bye as output.
  3. Print the respective output.
				
					iput = input("Enter your choice: ")

if iput == "Hello":
    print(1)
elif iput == "Bye":
    print(0)
else:
    print("Invalid choice")
				
			

Output :

				
					Enter your choice: Bye
0
				
			

Related Articles

check whether the last digit of a number defined by the user is divisible by 4 or not.

accept the car price of a car and display the road tax to be paid

Check whether the last digit of a number is divisible by 4

In this python if else program, we will check whether the last digit of a number defined by the user is divisible by 4

Steps to solve the program
  1. Take a number as input through the user.
  2. Get the last digit of a number by using %.
  3. Using an if-else statement check whether the last digit of a number is divisible by 4.
  4. Print the respective output.
				
					num = 118
last_digit = num%10

if last_digit%4 == 0:
    print("The last digit is divisible by 4")
else:
    print("The last digit is not divisible by 4")
				
			

Output :

				
					The last digit is divisible by 4
				
			

Related Articles

check the student’s eligibility to attend the exam based on his/her attendance.

display 1/0 if the user gives Hello/Bye as output.

Check the student’s eligibility to attend the exam

In this python if else program, we will check the student’s eligibility to attend the exam based on his/her attendance.

Steps to solve the program
  1. Take a student’s attendance % as input through the user.
  2. Using an if-else statement check the student’s eligibility to attend the exam.
  3. If the attendance is greater than or equal to 75 then the student is eligible, else the student is not eligible.
  4. Print the respective output.
				
					attendance = int(input("Enter attendance % of a student: "))

if attendance >= 75:
    print("Student is eligible")
else:
    print("Student is not eligible")
				
			

Output :

				
					Enter attendance % of a student: 78
Student is eligible
				
			

Related Articles

print the absolute value of a number defined by the user.

check whether the last digit of a number defined by the user is divisible by 4 or not.

Program to print the absolute value of a number

In this python if else program, we will print the absolute value of a number. If the number is negative then print its absolute value, else print the number.

Absolute value: The absolute value of a real number a is the non-negative value of a without regard to its sign.

Steps to solve the program
  1. Take a number as input through the user.
  2. Using an if-else statement check whether the input number is positive or negative.
  3. If the number is negative print its absolute value by using abs(),else print the number.
  4. Print the output.
				
					num = int(input("Enter a number: "))

if num<0:
    print("Absolute value of the number: ",abs(num))
else:
    print("Absolute value of the number: ",num)
				
			

Output :

				
					Enter a number: -1
Absolute value of the number:  1
				
			

Related Articles

Calculate the discount based on the bill.

check the student’s eligibility to attend the exam based on his/her attendance.

Python program to calculate the discount based on the bill.

In this python if else program, we will calculate the discount on the amount based on the bill.

Steps to solve the program
  1. Take the bill amount as input through the user and create a variable and assign its value equal to 0.
  2. Using an if-else statement find how much discount is applicable (i.e. 10% discount if the bill is more than 1000, and 20% if the bill is more than 2000).
  3. Calculate the discount using the formula discount %*(bill amount/100) and store the result in the variable that we have created at the beginning of the program.
  4. Print the output.
				
					bill = int(input("Enter bill amount: "))
discount = 0

if bill >= 2000:
    discount = 20*(bill/100)
elif 1000<= bill < 2000:
    discount = 10*(bill/100)
    
print("Discount amount: ",discount)
				
			

Output :

				
					Enter bill amount: 1500
Discount amount:  150.0
				
			

Related Articles

check if the input shape is sqaure or not.

print the absolute value of a number defined by the user.

Program to check whether the given shape is square

In this python if else program we will, take values of the length and breadth of a rectangle from the user and check if the shape is square or not.

Rectangle: A rectangle is a type of quadrilateral, whose opposite sides are equal and parallel.

Steps to solve the program
  1. Take the length and breadth of the rectangle as input.
  2. The area of the square is the side’s square and the area of a rectangle is length*breadth.
  3. Using an if-else statement check whether both of these values are equal or not.
  4. Print the respective output.
				
					length = int(input("Enter length: "))
breadth = int(input("Enter breadth: "))

if length**2 == length*breadth:
    print("It is a square")
else:
    print("It is not a sqaure")
				
			

Output :

				
					Enter length: 5
Enter breadth: 4
It is not a sqaure
				
			

Related Articles

find employees eligible for bonus..

Calculate the discount based on the bill.