# Filename : test.py
# author by : www..com
# Simplest case
print(max(1, 2))
print(max('a', 'b'))
# Can also be used with lists and tuples
print(max([1,2]))
print(max((1,2)))
# More examples
print("The maximum of 80, 100, 1000 is: ", max(80, 100, 1000))
print("The maximum of -20, 100, 400 is: ", max(-20, 100, 400))
print("The maximum of -80, -20, -10 is: ", max(-80, -20, -10))
print("The maximum of 0, 100, -400 is:", max(0, 100, -400))
Executing the above code produces the following output:
2
b
2
2
The maximum of 80, 100, 1000 is: 1000
The maximum of -20, 100, 400 is: 400
The maximum of -80, -20, -10 is: -10
The maximum of 0, 100, -400 is: 100
Introduction to the max() function: Python max() function.
Python3 Examples