Python's min () function can also be used to compare tuple

Source: Internet
Author: User
Tags iterable

Python's min () function can also be used to compare tuple

>>> A = (2,'ASV','DFG')>>> B = (3,'GSG','Weg')>>> C = (5,' Bad','ser')>>>min (A, B, c) (2,'ASV','DFG')>>>

This is the official document.

min (iterable[, key]) min (arg1, arg2, *args[, key])

Return the smallest item in a iterable or the smallest of the or more arguments.

If One positional argument is provided, iterable must bes a non-empty iterable (such as a non-empty string, TUPL e or list). The smallest item in the iterable is returned. If or more positional arguments was provided, the smallest of the positional arguments is returned.

The optional key argument specifies a one-argument ordering function like this used for list.sort (). The key argument, if supplied, must is in keyword form (for example, min (a,b,c,key=func)).

Changed in version 2.5:added support for the optional key argument.

Python's min () function can also be used to compare tuple

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.