find greatest of two numbers in python code example
Example 1: greatest of three numbers in python
a=int(input())
b=int(input())
c=int(input())
if(a>b):
if(a>c):
print("a")
else:
print("c")
else:
if(b>c):
print("b")
else:
print("c")
Example 2: how to find greatest number in python
Method 1 : Sort the list in ascending order and print the last element in the list.
filter_none
edit
play_arrow
brightness_4
list1 = [10, 20, 4, 45, 99]
list1.sort()
print("Largest element is:", list1[-1])
Output:
Largest element is: 99