PYTHON COMPLETE BUILT-IN FUNCTIONS
[Link](x) -> Absolute value of a number. Example: print(abs(-5)) # 5
[Link](async_iterable) -> Async iterator for an object. Example: async_iter = aiter(obj)
3. all(iterable) -> True if all elements are truthy. Example: print(all([True, 1])) # True
4. anext(async_iterator) -> Awaits next item from async iterator. Example: item = await
anext(it)
5. any(iterable) -> True if any element is truthy. Example: print(any([False, 1])) # True
6. ascii(object) -> Escapes non-ASCII characters. Example: print(ascii("Café")) #
'Caf\\xe9'
7. bin(x) -> Converts integer to binary string. Example: print(bin(10)) # '0b1010'
8. bool(x) -> Converts value to a Boolean. Example: print(bool(0)) # False
9. breakpoint(*args, **kws) -> Drops execution into system debugger. Example:
breakpoint()
10. bytearray([source]) -> Creates mutable array of bytes. Example: arr = bytearray(b'hi')
11. bytes([source]) -> Creates immutable bytes object. Example: b = bytes(b'hi')
12. callable(object) -> True if object can be called. Example: print(callable(print)) # True
13. chr(i) -> Converts integer Unicode point to character. Example: print(chr(65)) # 'A'
14. classmethod(function) -> Converts method into a class method. Example:
@classmethod
15. compile(source, filename, mode) -> Compiles source string into code object.
16. complex([real[, imag]]) -> Creates complex number. Example: print(complex(2, 3)) #
(2+3j)
17. delattr(object, name) -> Deletes named attribute from an object. Example: delattr(obj,
'x')
18. dict(**kwarg) -> Instantiates or converts data to a dictionary. Example: dict(a=1)
19. dir([object]) -> Lists valid attributes/methods of an object. Example: dir([])
20. divmod(a, b) -> Returns tuple of (quotient, remainder). Example: print(divmod(20,
3)) # (6, 2)
21. enumerate(iterable, start=0) -> Pairs items with index counter. Example:
list(enumerate(['a']))
22. eval(expression) -> Parses and runs single-line string expression. Example: eval("2 +
3")
23. exec(object) -> Executes blocks of complex code dynamically. Example: exec("x =
5\\nprint(x)")
24. filter(function, iterable) -> Extracts items satisfying a condition. Example: filter(lambda
x: x>1, [1,2])
25. float(x) -> Converts integer or string to float. Example: print(float("3.14")) # 3.14
26. format(value[, format_spec]) -> Formats a value customly. Example: format(0.5, '%') #
'50.000000%'
27. frozenset([iterable]) -> Creates immutable set object. Example: frozenset([1, 2])
28. getattr(object, name) -> Retrieves value of specific named attribute. Example:
getattr(str, "__name__")
29. globals() -> Dictionary showing current global symbol table. Example: globals()
30. hasattr(object, name) -> True if object has specified attribute. Example: hasattr(str,
"lower")
31. hash(object) -> Returns fixed integer hash value of immutable object. Example:
hash("abc")
32. help([object]) -> Invokes built-in interactive help utility. Example: help([Link])
33. hex(x) -> Converts integer to hexadecimal string. Example: print(hex(255)) # '0x ' 34.
id(object) -> Returns unique memory address address of an object. Example: id(x)
35. input([prompt]) -> Pauses execution to accept typed line of text. Example:
input("Name: ")
36. int(x=0, base=10) -> Converts number or string to standard integer. Example: int("42")
37. isinstance(object, classinfo) -> True if object matches given class/type. Example:
isinstance("hi", str)
38. issubclass(class, classinfo) -> True if class is subclass of another. Example:
issubclass(bool, int)
39. iter(object) -> Generates iterator object from collection. Example: items = iter([1, 2])
40. len(s) -> Counts and returns total items in an object. Example: print(len("Python")) # 6
41. list([iterable]) -> Converts iterable sequence into mutable list. Example: list((1, 2))
42. locals() -> Dictionary showing current local symbol table. Example: locals()
43. map(function, iterable) -> Runs function across every item in iterable. Example:
map([Link], ['a'])
44. max(iterable) -> Locates largest item within an iterable/arguments. Example: max(5, 9,
3) # 9
45. memoryview(object) -> Safe memory view wrapper from binary argument. Example:
memoryview(b"hi")
46. min(iterable) -> Locates smallest item within an iterable/arguments. Example:
min(5, 9, 3) # 3
47. next(iterator) -> Retrieves next sequential item from valid iterator. Example:
next(iterator)
48. object() -> Returns a baseline, featureless object. Example: empty_obj = object()
49. oct(x) -> Converts integer into an octal string. Example: print(oct(8)) # '0o10'
50. open(file, mode='r') -> Opens file and returns corresponding stream object. Example:
open("[Link]")
51. ord(c) -> Looks up integer Unicode code point for single character. Example:
print(ord('A')) # 65
52. pow(base, exp[, mod]) -> Computes base raised to power (x**y). Example:
print(pow(2, 3)) # 8
53. print(*objects) -> Outputs text or object data to console window. Example:
print("Hello")
54. property(fget, fset, fdel) -> Managed property attribute getter/setter wrapper. Example:
@property
55. range(stop) -> Generates immutable sequence of numbers over span. Example:
list(range(3)) # [0,1,2]
56. repr(object) -> Generates formal printable string representation. Example:
print(repr("hi")) # "'hi'"
57. reversed(seq) -> Returns a reverse-order iterator for given sequence. Example:
reversed([1,2])
58. round(number[, ndigits]) -> Rounds float to specific decimal places. Example:
round(3.14159, 2) # 3.14
59. set([iterable]) -> Converts iterable sequence into unique mutable set. Example:
set([1,2,2]) # {1,2}
60. setattr(object, name, value) -> Dynamically sets attribute value on object. Example:
setattr(obj, 'x', 10)
61. slice(start, stop) -> Creates explicit slice range index block object. Example: cut =
slice(0, 2)
62. sorted(iterable) -> Generates a new sorted list from arbitrary items. Example:
sorted([3,1,2])
63. staticmethod(function) -> Converts regular method into explicit static method.
Example: @staticmethod
64. str(object='') -> Converts any given object into string representation. Example: str(123)
# '123'
65. sum(iterable) -> Adds items of a numeric iterable together. Example: sum([1,2,3]) # 6
66. super() -> Returns proxy object delegating calls to parent classes. Example:
super().__init__()
67. tuple([iterable]) -> Converts an iterable sequence into immutable tuple. Example:
tuple([1, 2])
68. type(object) -> Identifies and returns exact data type of object. Example:
print(type(42)) # <class 'int'>
69. vars([object]) -> Returns dictionary mapping dictionary (__dict__) of object. Example:
vars(obj)
70. zip(*iterables) -> Aggregates multi-iterable elements into matching tuples. Example:
zip([1], ['a'])or list,set,range it will zip any iterable with another but they both have to be an iterable
71. __import__(name) -> Programmatic backend module loader call. Example: sys =
__import__('sys')
zip() creates a lazy iterator. It doesn't generate or store all the combined pairs in memory up front. Instead, it
computes each pair on the fly, one at a time, as you request [Link] it is an iterator, printing it directly just
shows you the memory address of the iterator object which is why, you have to explicitly convert it (e.g., using
list()) if you want to inspect all the items at once.
example:
names = ["Alice", "Bob", "Charlie"]
scores = [85, 92, 78]
zipped = zip(names, scores)
print(zipped)
print(list(zipped))