Given two numbers, write a Python code to find the Maximum of these two numbers.
Input: a = 2, b = 4 Output: 4 Input: a = -1, b = -4 Output: -1
Method #1: This is the naive approach where we will compare tow numbers using if-else statement and will print the output accordingly.
Method #2: Using max() function
This function is used to find the maximum of the values passed as its arguments.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Maximum and Minimum value from two lists
- Python - Find the Maximum of Similar Indices in two list of Tuples
- Highlight the maximum value in last two columns in Pandas - Python
- Python Dictionary | Check if binary representations of two numbers are anagram
- Python program to add two numbers
- Minimum of two numbers in Python
- Python Program to find the Quotient and Remainder of two numbers
- Python Program to swap two numbers without using third variable
- Find the sum and maximum value of the two column in excel file using Pandas
- Python program to check if the list contains three consecutive common numbers in Python
- What is the maximum possible value of an integer in Python ?
- Python - Maximum product using K elements
- Python program maximum of three
- Python Regex to extract maximum numeric value from a string
- Python | Maximum and minimum element's position in a list
- Python | Maximum sum of elements of list in a list of lists
- Python map function to find row with maximum number of 1's
- Python | Maximum and Minimum in a Set
- numpy.maximum() in Python
- Python | Pandas series.cummax() to find Cumulative maximum of a series
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.