Hello people, here we discuss a simple python program which finds the biggest and smallest number out of given three numbers. Here we use python lists in this program.
Here we add the 3 numbers to list and use max and min functions on it to find the biggest and smallest number respectively.
Biggest and Smallest of 3 numbers – Code Visualization
To find smallest and biggest number out of given 3 numbers.
- Read 3 input numbers using
- Add these 3 numbers to list
lst = [number1, number2, number3].
max()function to find the biggest number
- Finding smallest number by using
- Print the result.
number1 = int(input('Enter First number : '))
number2 = int(input('Enter Second number : '))
number3 = int(input('Enter Third number : '))
lst = [number1, number2, number3]
print("The largest of the 3 numbers is : ", max(lst))
print("The smallest of the 3 numbers is : ", min(lst))