Built-in functions Flashcards

(66 cards)

1
Q

Function: abs(x)

A

Description: Returns the absolute value of a number x.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Function: all(iterable)

A

Description: Returns True if all elements in the iterable are true (or if the iterable is empty).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Function: any(iterable)

A

Description: Returns True if any element in the iterable is true. Returns False if the iterable is empty.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Function: ascii(object)

A

Description: Returns a string containing a printable representation of an object, escaping non-ASCII characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Function: bin(x)

A

Description: Converts an integer x to a binary string prefixed with “0b”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Function: bool(x)

A

Description: Converts a value x to a Boolean (True or False).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Function: breakpoint()

A

Description: Enters the debugger at the call site.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Function: bytearray(source)

A

Description: Returns a new array of bytes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Function: bytes(source)

A

Description: Returns a new “bytes” object (immutable).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Function: callable(object)

A

Description: Returns True if the object appears callable (like a function), False otherwise.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Function: chr(i)

A

Description: Returns the string representing a character whose Unicode code point is the integer i.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Function: classmethod(function)

A

Description: Transforms a method into a class method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Function: complex(real, imag)

A

Description: Creates a complex number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Function: delattr(object, name)

A

Description: Deletes the named attribute from the object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Function: dict(**kwargs)

A

Description: Creates a new dictionary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Function: dir(object)

A

Description: Returns a list of valid attributes for the specified object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Function: divmod(a, b)

A

Description: Returns a tuple containing the quotient and the remainder of (a / b).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Function: enumerate(iterable, start=0)

A

Description: Returns an enumerate object (iterator of tuples with count and value).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Function: filter(function, iterable)

A

Description: Constructs an iterator from elements of iterable for which function returns true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Function: float(x)

A

Description: Converts a string or number x to a floating-point number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Function: format(value, format_spec)

A

Description: Formats a value using a specified format specification.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Function: frozenset(iterable)

A

Description: Returns a new immutable frozenset object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Function: getattr(object, name, default)

A

Description: Gets the value of a named attribute from an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Function: globals()

A

Description: Returns a dictionary representing the current global symbol table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Function: hasattr(object, name)
Description: Returns True if the object has the given named attribute.
26
Function: hash(object)
Description: Returns the hash value of the object (if it has one).
27
Function: help(object)
Description: Invokes the built-in help system.
28
Function: hex(x)
Description: Converts an integer x to a lowercase hexadecimal string prefixed with "0x".
29
Function: id(object)
Description: Returns the "identity" (memory address) of an object.
30
Function: input(prompt)
Description: Reads a line from console, converting it to a string.
31
Function: int(x)
Description: Converts a string or number x to an integer.
32
Function: isinstance(object, classinfo)
Description: Returns True if the object is an instance of the classinfo.
33
Function: issubclass(class, classinfo)
Description: Returns True if class is a subclass of classinfo.
34
Function: iter(object)
Description: Returns an iterator object.
35
Function: len(s)
Description: Returns the length (number of items) of an object s.
36
Function: list(iterable)
Description: Creates a new list.
37
Function: locals()
Description: Returns a dictionary representing the current local symbol table.
38
Function: map(function, iterable, ...)
Description: Returns an iterator that applies function to every item of iterable.
39
Function: max(iterable)
Description: Returns the largest item in an iterable.
40
Function: min(iterable)
Description: Returns the smallest item in an iterable.
41
Function: next(iterator, default)
Description: Retrieves the next item from the iterator.
42
Function: object()
Description: Returns a new featureless object (base for all classes).
43
Function: oct(x)
Description: Converts an integer x to an octal string prefixed with "0o".
44
Function: open(file, mode)
Description: Opens a file and returns a corresponding file object.
45
Function: ord(c)
Description: Returns the integer representing the Unicode code point of the character c.
46
Function: pow(base, exp, mod)
Description: Returns base to the power exp
47
Function: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
Description: Prints objects to the text stream file.
48
Function: property(fget, fset, fdel, doc)
Description: Returns a property attribute.
49
Function: range(stop)
Description: Returns an immutable sequence of numbers.
50
Section: range(start, stop, step)
Description: Returns an immutable sequence of numbers from start to stop by step.
51
Function: repr(object)
Description: Returns a string containing a printable representation of an object (for debugging).
52
Function: reversed(seq)
Description: Returns a reverse iterator.
53
Function: round(number, ndigits)
Description: Rounds a number to a given precision in decimal digits.
54
Function: set(iterable)
Description: Creates a new set object.
55
Function: setattr(object, name, value)
Description: Sets the value of a named attribute on an object.
56
Function: slice(stop)
Description: Returns a slice object.
57
Function: slice(start, stop, step)
Description: Returns a slice object representing the set of indices specified by range(start, stop, step).
58
Function: sorted(iterable, key=None, reverse=False)
Description: Returns a new sorted list from the items in iterable.
59
Function: staticmethod(function)
Description: Transforms a method into a static method.
60
Function: str(object)
Description: Returns a 'str' version of object (human-readable).
61
Function: sum(iterable, start=0)
Description: Sums the items of an iterable from left to right and returns the total.
62
Function: super()
Description: Returns a proxy object that delegates method calls to a parent or sibling class.
63
Function: tuple(iterable)
Description: Creates a new tuple.
64
Function: type(object)
Description: Returns the type of an object.
65
Function: vars(object)
Description: Returns the __dict__ attribute of an object.
66
Function: zip(*iterables)
Description: Returns an iterator that aggregates elements from each of the iterables.