Accept the temperature in Fahrenheit and check whether the water is boiling

In this python if else program, accept the temperature in Fahrenheit and check whether the water is boiling or not.

To convert temperatures in degrees Fahrenheit to Celsius, subtract 32 and multiply by .5556 (or 5/9). To convert temperatures in degrees Celsius to Fahrenheit, multiply by 1.8 (or 9/5) and add 32.

Steps to solve the program
  1. Take the temperature in Fahrenheit as input through the user.
  2. The boiling temperature of water in Fahrenheit is 212.
  3. Using an if-else statement check whether the input temperature is equal to 212.
  4. Print the respective output.
				
					temp = int(input("Enter temperature of water in Fahrenheit: "))

if temp != 212:
    print("Water is not boiling")
else:
    print("Water is boiling")
				
			

Output :

				
					Enter temperature of water in Fahrenheit: 190
Water is not boiling
				
			

Related Articles

find the lowest number between three numbers.

accept two numbers and mathematical operations from users 

Find the lowest number between three numbers.

In this python if else program, we will find the lowest number between three numbers.

Steps to solve the program
  1. Take three numbers as input.
  2. Using nested if-else statements find the lowest number among them.
  3. If num1 is less than num2 create a nested if-else statement to check whether the num1 is less than num2 if yes then num1 is the lowest number.
  4. If num2 is less than num1 create a nested if-else statement to check whether the num2 is less than num3 if yes then num2 is the lowest number.
  5. Else num3 is the lowest number.
  6. Print the respective output.
				
					num1 = 45
num2 = 23
num3 = 68

if num1<num2:
    if num1<num3:
        print("Lowest numbner: ",num1)
elif num2<num1:
    if num2<num3:
        print("Lowest numbner: ",num2)
else:
    print("Lowest number: ",num3)
				
			

Output :

				
					Lowest numbner:  23
				
			

Related Articles

check whether the citizen is a senior citizen or not.

accept the temperature in Fahrenheit and check whether the water is boiling or not.

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.