Sideway
output.to from Sideway
Draft for Information Only

Content

Python Built-in Misc. Functions
len()
  Parameters
  Remarks
max()
  Parameters
  Remarks
min()
  Parameters
  Remarks
next()
  Parameters
  Remarks
sum()
  Parameters
  Remarks
 Source and Reference

Python Built-in Misc. Functions

The Python interpreter has some built-in misc. functions.

len()

len(𝑠)

Parameters

len()to return the length or number of items of an object. 𝑠to specify the object to be returned from

Remarks

  • 𝑠 may be a sequence, such as a string, bytes, tuple, list, or range, or a collection, such as a dictionary, set, or frozenset

max()

max(iterable, *[, key, default]) max(arg1, arg2, *args[, key])

Parameters

max()to return the largest item in an iterable or the largest of two or more arguments. iterableto specify an iterable to be returned from keyoptional, to specify a one-argument ordering function like that used for list.sort(). defaultoptional, to specify an object to return if the provided iterable is empty. arg1to specify the first positional argument to be returned from arg2to specify the second positional argument to be returned from *argsto specify the third or more positional arguments to be returned from

Remarks

  • If one positional argument is provided, it should be an iterable. The largest item in the iterable is returned.
  • If two or more positional arguments are provided, the largest of the positional arguments is returned.
  • There are two optional keyword-only arguments.
  • if key specifies a one-argument ordering function like that used for list.sort().
  • if default specifies an object to return if the provided iterable is empty
  • If the iterable is empty and default is not provided, a ValueError is raised.
  • If multiple items are maximal, the functon returns the first one encountered. This is consistent with other sort-stability preserving tools, such as sorted(iterable, key=keyfunc, reverse=True)[0] and heapq.nlargest(1, iterable, key=keyfunc)

min()

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

Parameters

min()to return the smallest item in an iterable or the smallest of two or more arguments. iterableto specify an iterable to be returned from keyoptional, to specify a one-argument ordering function like that used for list.sort(). defaultoptional, to specify an object to return if the provided iterable is empty. arg1to specify the first positional argument to be returned from arg2to specify the second positional argument to be returned from *argsto specify the third or more positional arguments to be returned from

Remarks

  • If one positional argument is provided, it should be an iterable. The smallest item in the iterable is returned.
  • If two or more positional arguments are provided, the smallest of the positional arguments is returned.
  • There are two optional keyword-only arguments.
  • if key specifies a one-argument ordering function like that used for list.sort().
  • if default specifies an object to return if the provided iterable is empty
  • If the iterable is empty and default is not provided, a ValueError is raised.
  • If multiple items are minimal, the functon returns the first one encountered. This is consistent with other sort-stability preserving tools, such as sorted(iterable, key=keyfunc, reverse=True)[0] and heapq.nlargest(1, iterable, key=keyfunc)

next()

next(iterator[, default])

Parameters

next()to return the next item from the iterator. iteratorto specify the iterator to be returned from [default]to specify the default to be returned if the iterator is exhausted.

Remarks

  • To retrieve the next item from the iterator by calling its __next__() method.
  • If default is given, it is returned if the iterator is exhausted, otherwise StopIteration is raised.

sum()

sum(iterable, /, start=0)

Parameters

sum()to return the sum of the elements of an iterable . iterableto specify an iterable to be returned from / start=0to specify the starting value

Remarks

  • Sums start and the items of an iterable from left to right and returns the total. The iterable’s items are normally numbers, and the start value is not allowed to be a string. For some use cases, there are good alternatives to sum(). The preferred, fast way to concatenate a sequence of strings is by calling ''.join(sequence). To add floating point values with extended precision, see math.fsum(). To concatenate a series of iterables, consider using itertools.chain().

Source and Reference


©sideway

ID: 201002902 Last Updated: 10/29/2020 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019