Python basic functions

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/70

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

71 Terms

1
New cards

abs()

returns the absolute value of a number

2
New cards

aiter()

returns an asynchronous iterator from an async iterable

3
New cards

all()

returns True if all elements of an iterable are true

4
New cards

anext()

returns the next item from an async iterator

5
New cards

any()

returns True if at least one element of an iterable is true

6
New cards

ascii()

returns a readable version of an object (escapes non-ASCII chars)

7
New cards

bin()

converts a number to a binary string

8
New cards

bool()

converts a value to True or False

9
New cards

breakpoint()

drops into debugger at the calling point

10
New cards

bytearray()

creates a mutable sequence of bytes

11
New cards

bytes()

creates an immutable sequence of bytes

12
New cards

callable()

checks if the object is callable (like a function)

13
New cards

chr()

returns a character from a Unicode code point

14
New cards

classmethod()

defines a class method inside a class

15
New cards

compile()

compiles code (string or AST) into a code object

16
New cards

complex()

creates a complex number

17
New cards

delattr()

deletes an attribute from an object

18
New cards

dict()

creates a dictionary

19
New cards

dir()

lists all attributes and methods of an object

20
New cards

divmod()

returns quotient and remainder as a tuple

21
New cards

enumerate()

returns an enumerate object with index + value pairs

22
New cards

eval()

evaluates a string as Python code

23
New cards

exec()

executes Python code dynamically

24
New cards

filter()

filters elements of an iterable using a function

25
New cards

float()

converts a value to a floating-point number

26
New cards

format()

formats a value into a string

27
New cards

frozenset()

creates an immutable set

28
New cards

getattr()

gets the attribute of an object

29
New cards

globals()

returns the dictionary of global variables

30
New cards

hasattr()

checks if an object has a named attribute

31
New cards

hash()

returns the hash value of an object

32
New cards

help()

shows the help system/documentation

33
New cards

hex()

converts a number to hexadecimal string

34
New cards

id()

returns the unique ID of an object

35
New cards

input()

reads input from the user

36
New cards

int()

converts a value to an integer

37
New cards

isinstance()

checks if an object is an instance of a class

38
New cards

issubclass()

checks if a class is a subclass of another class

39
New cards

iter()

returns an iterator for an iterable

40
New cards

len()

returns the length of an object

41
New cards

list()

creates a list

42
New cards

locals()

returns the dictionary of local variables

43
New cards

map()

applies a function to each element of an iterable

44
New cards

max()

returns the largest item in an iterable

45
New cards

memoryview()

creates a memory view object

46
New cards

min()

returns the smallest item in an iterable

47
New cards

next()

retrieves the next item from an iterator

48
New cards

object()

creates a new base object

49
New cards

oct()

converts a number to octal string

50
New cards

open()

opens a file and returns a file object

51
New cards

ord()

returns the Unicode code point of a character

52
New cards

pow()

returns x raised to the power y (optionally modulo z)

53
New cards

print()

prints text/output to the console

54
New cards

property()

defines a property in a class

55
New cards

range()

returns a sequence of numbers

56
New cards

repr()

returns a string representation of an object

57
New cards

reversed()

returns a reversed iterator

58
New cards

round()

rounds a number to given digits

59
New cards

set()

creates a set

60
New cards

setattr()

sets an attribute of an object

61
New cards

slice()

creates a slice object for indexing

62
New cards

sorted()

returns a sorted list from an iterable

63
New cards

staticmethod()

defines a static method inside a class

64
New cards

str()

converts a value to a string

65
New cards

sum()

sums items of an iterable

66
New cards

super()

calls a method from a parent class

67
New cards

tuple()

creates a tuple

68
New cards

type()

returns the type of an object (or creates a class)

69
New cards

vars()

returns the dict attribute of an object

70
New cards

zip()

combines multiple iterables into tuples

71
New cards

import()

imports a module dynamically