Input two numbers and display the larger / smaller number in Python. Today we are showing the code in python. This python project is useful for beginners, CBSE School Class 11 students Computer Science practical file and NIELIT O Level Programming and Problem Solving through Python (Module M3-R5).
If/else case in Python
In if case first the condition in the same line of if is evaluated if it is true then it is executed and else the commands after else is executed. So, This is evaluation method , plus executing method.
Objective : Input two numbers and display the larger / smaller number in Python.
Screenshot of the source code written it is very important to read every step
Program code Input two numbers and display the larger / smaller number in Python.
Python Program to find Largest of two Numbers using if-else statements
a = int(input(“Enter the first number: “)) #input first number
b = int(input(“Enter the second number: “)) #input second number
if(a >= b): #comparing
print(a, “is greater”)
print(b, “is greater”)
Output of the program
We enter the first number : 56 and the second number :28 an then comparing it tells 56 is greater.
Testing is done .
Run the python program and enter the required data.
Source code of Program -> click here
Thanks for reading and learning about this program.
for more python programs -> click here