Write a Python program to print the largest of three numbers.

Jhoshitha N A
1 min readMay 17, 2021

Project done through Code kata.

What is CODEKATA?

Practising code kata will improve the programming skills. Code kata is a series of solving programs by taking the raw inputs. It enhances our profile.

Reference: https://www.guvi.in/code-kata

You are given three numbers A, B & C. Print the largest amongst these three numbers.

Code:

def maximum(a, b, c):

if (a >= b) and (a >= c):

largest = a

elif (b >= c):

largest = b

else:

largest = c

return largest

a = int(input())

b = int(input())

c = int(input())

print(maximum(a, b, c))

Language used: PYTHON 3

Description:

Get 3 inputs from the user

Use an if-else statement, If (num1 > num2) and (num1 > num3), Print num1

Else if (num2 > num1) and (num 2 > num3), Print num2

Else, print num3

End the program

In the program below, the three numbers are stored in num1, num2 and num3 respectively. We’ve used the if…elif…else ladder to find the largest among the three and display it.

Reference:

--

--