-
-
Notifications
You must be signed in to change notification settings - Fork 308
Conversation
`max()` is a built-in function in Python 3. It returns the largest item in an iterable or the largest of two or more arguments. | ||
|
||
## Arguments | ||
This function takes two or more numbers or any kind of iterable as an argument. While giving an iterable as an argument we must make sure that all the elements in the iterable are of the same type. This means that we cannot pass a list which has both string and integer values stored in it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This function takes two or more numbers or any kind of iterable as an argument
+ This function takes two or more numbers, or any kind of iterable as an argument
When you say numbers, what do you mean? int
or float
? Or both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can also compare between Strings, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
It can take both int and floats and it can even compare them together.
It works for strings too. It checks for lexicographical order.
eg: max('abc', 'abb', 'abc') # returns 'abc'
LGTM 👍Let's 📦 |
@varunu28 Just updated! |
@atjonathan There are 2 articles which are not updated. min and pow. Kindly check |
* Create Python-Function-MAX.md * Update Python-Function-MAX.md * Update Python-Function-MAX.md
No description provided.