Accept marks from the user allot the stream based on marks

In this python if else program, we will accept marks from the user allot the stream based on the marks.

Steps to solve the program
  1. Accepts the marks from the user.
  2. Using if-else statements allot the stream based on marks.
  3. Print the output.
				
					marks = int(input("Enter marks: "))

if 85 <= marks <101:
    print("Stream alloted: Science")
elif 70 <= marks < 85:
    print("Stream alloted: Commerce")
elif 35 <= marks < 70:
    print("Arts")
elif 0 < marks < 35:
    print("Stream alloted: Fail")
else:
    print("Invalid marks")
				
			

Output :

				
					Enter marks: 88
Stream alloted: Science
				
			

Related Articles

accept two numbers and mathematical operations from users

Accept two numbers and mathematical operations from users

In this python if else program, we will accept two numbers and mathematical operations from users and perform mathematical operations according to it.

Arithmetic operations in Maths:
Addition (Finding the Sum; ‘+’)
Subtraction (Finding the difference; ‘-‘)
Multiplication (Finding the product; ‘×’ )
Division (Finding the quotient; ‘÷’)

Steps to solve the program
  1. Take two numbers and a mathematical operation of your choice (+,-,*,/) as input.
  2. Using if-else statements perform the corresponding operations on numbers.
  3. Print the output.
				
					num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
operation = input("Enter operation of your choice")

if operation == "+":
    print(num1+num2)
elif operation == "-":
    print(num1-num2)
elif operation == "/":
    print(num1/num2)
elif operation == "*":
    print(num1*num2)
else:
    print("Invalid operation")
				
			

Output :

				
					Enter 1st number: 30
Enter 2nd number: 45
Enter operation of your choice: +
75
				
			

Related Articles

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

accept marks from the user allot the stream

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.