Built-ins
ID | Name | Description | Module | Step | Explanation | Example |
---|---|---|---|---|---|---|
1 | print |
1 | 2 | Prints the value to the screen. |
|
|
2 | + |
addition |
1 | 3 | Adds two numbers. |
|
3 | - |
subtraction |
1 | 3 | Subtracts the first number by the second. |
|
4 | * |
multiplication |
1 | 3 | Multiplies two numbers. |
|
5 | / |
division |
1 | 3 | Divides the first number by the second. |
|
6 | + |
unary plus |
1 | 3 | Used on one value, does not change the number. |
|
7 | - |
negation |
1 | 3 | Used on one value, negates the number. |
|
8 | // |
quotient |
1 | 3 | Calculates the quotient when the first number is divided by the second. |
|
9 | % |
remainder |
1 | 3 | Calculates the remainder when the first number is divided by the second. |
|
10 | ** |
exponentiation |
1 | 3 | Raises the first number to the power of the second number. |
|
11 | import |
import |
2 | 3 | Used to import a module. |
|
12 | math |
math module |
2 | 3 | The math module. Contains functions and constants relating to math. |
After the math module is imported, |
13 | sqrt |
square root |
2 | 3 | Determines the square root of the input. In the math module. |
After the math module is imported, |
14 | pi |
pi |
2 | 3 | The constant (\pi). In the math module. |
After the math module is imported, the constant can be accessed as |
15 | dir |
directory |
2 | 3 | Used with the input |
Using |
16 | from math import |
import a single function or constant |
2 | 3 | Used to import a single function or constant from a module. |
After using |
17 | pow |
exponentiation |
2 | 3 | Uses the first input as the base and the second as the exponent. There are two versions. The version in the math module always returns a floating point number. |
|
18 | abs |
absolute value |
2 | 3 | Produces the absolute value of the input. |
|
19 | __doc__ |
documentation |
2 | 3 | Prints the docstring. Uses dot notation. |
The docstring for |
20 | input |
user input |
2 | 4 | Prompts the user to type a value. The optional string is the prompt. |
The function call |
21 | type |
determine type |
2 | 4 | Produces the type of the input. |
The value of |
22 | int |
make into integer |
2 | 4 | Makes an integer, floating point number, or string (if an integer in quotation marks) into an integer. |
The values of |
23 | float |
make into floating point |
2 | 4 | Makes an integer, floating point number, or string (if a number in quotation marks) into a floating point number. |
The values of |
24 | str |
make into string |
2 | 4 | Makes a number or a string into a string. |
The values of |
25 | len |
length |
2 | 7 | Produces the length of a string. |
The values of |
26 | [i] |
index |
2 | 7 | Produces the character in position |
The value of |
27 | + |
concatenation |
2 | 7 | Produces the string formed by gluing together the input strings. |
The value of |
28 | * |
repeated concatenation |
2 | 7 | Produces the string formed by repeatedly gluing the input with copies of the input. |
The value of |
29 | [a:b] |
slice |
2 | 7 | Produces a substring from positions |
The value of |
30 | upper |
upper case |
2 | 8 | Produces a string with all lower-case letters replaced by upper-case letters. Uses dot notation. |
The value of |
31 | lower |
lower case |
2 | 8 | Produces a string with all upper-case letters replaced by lower-case letters. Uses dot notation. |
The value of |
32 | ceil |
ceiling |
2 | 8 | Produces the integer reached by pushing up to the ceiling. In the math module. |
The values of |
33 | floor |
floor |
2 | 8 | Produces the integer reached by pushing down to the floor. In the math module. |
The values of |
34 | trunc |
truncation |
2 | 8 | Produces the integer formed by cutting off all digits after the decimal point. In the math module. |
The values of |
35 | True |
true |
5 | 3 | The Boolean constant True. |
If the value of a Boolean is not |
36 | False |
false |
5 | 3 | The Boolean contant False. |
If the value of a Boolean is not |
37 | or |
or |
5 | 3 | Produces |
The value of |
38 | and |
and |
5 | 3 | Produces |
The value of |
39 | not |
not |
5 | 3 | Produces |
The value of |
40 | < |
less than |
5 | 3 | Produces |
The value of |
41 | > |
greater than |
5 | 3 | Produces |
The value of |
42 | <= |
less than or equal to |
5 | 3 | Produces |
The value of |
43 | >= |
greater than or equal to |
5 | 3 | Produces |
The value of |
44 | == |
equals |
5 | 3 | Produces |
The value of |
45 | != |
not equals |
5 | 3 | Produces |
The value of |
46 | is |
is |
5 | 3 | Produces |
For a variable |
47 | is not |
is not |
5 | 3 | Produces |
The value of |
48 | ord |
code point from character |
5 | 3 | Produces the code point corresponding to the input character. |
The value of |
49 | chr |
character from code point |
5 | 3 | Produces the character corresponding to the input code point. |
The value of |
50 | isalpha |
letter check |
5 | 3 | Produces |
The value of |
51 | islower |
lower case check |
5 | 3 | Produces |
The value of |
52 | isupper |
upper case check |
5 | 3 | Produces |
The value of |
53 | isdigit |
digit check |
5 | 3 | Produces |
The value of |
54 | isspace |
space check |
5 | 3 | Produces |
The value of |
55 | assert |
assertion |
7 | 7 | Results in an assertion error if the Boolean expression after |
Running a program containing the line |
56 | len |
list length |
9 | 2 | Produces the length of a list. |
The value of |
57 | [i] |
index |
9 | 2 | Produces the item in position |
The value of |
58 | + |
concatenation |
9 | 2 | Produces the list formed by gluing together the input lists. |
The value of |
59 | * |
repeated concatenation |
9 | 2 | Produces the list formed by repeatedly gluing the input with copies of the input. |
The value of |
60 | [a:b] |
slice |
9 | 2 | Produces a list from positions |
The value of |
61 | min |
minimum |
9 | 3 | Produces the minimum item in the list. The input list does not change. |
The value of |
62 | max |
maximum |
9 | 3 | Produces the maximum item in the list. The input list does not change. |
The value of |
63 | count |
count |
9 | 3 | Produces the number of times the input item appears in the input list. Uses dot notation. The input list does not change. |
The value of |
64 | index |
search |
9 | 3 | Produces the smallest index of a position containing the input item in the input list. Uses dot notation. The input list does not change. |
The value of |
65 | in |
membership |
9 | 3 | Produces |
The value of |
66 | list |
new list |
9 | 3 | Produces a new list containing the items of the input as items. The input list does not change. |
The value of |
67 | sorted |
sorted |
9 | 3 | Produces a new list with the input items in sorted order. The input list does not change. |
The value of |
68 | append |
append |
9 | 3 | Mutates the input list by appending the input item to the end of the list. |
For a variable |
69 | remove |
remove |
9 | 3 | Mutates the input list by removing the first occurrence of the input item from the list. |
For a variable |
70 | insert |
insert |
9 | 3 | Mutates the input list by inserting at the input index the input item. |
For a variable |
71 | sort |
sort |
9 | 3 | Mutates the input list by sorting the items. |
For a variable |
72 | range |
range |
10 | 2 | Produces an immutable sequence of integers starting at |
The value of |
73 | split |
split |
10 | 8 | Produces a list of strings from an input string. Uses dot notation. |
The value of |
74 | class |
class definition |
11 | 2 | Creates a new class. |
To create a class |
75 | isinstance |
instance check |
11 | 2 | Produces |
The value of |
76 | hasattr |
attribute check |
11 | 2 | Produces |
The value of |
77 | dir |
directory |
11 | 2 | Used with an class name as input to show contents of a class. |
Using |
78 | copy |
copy module |
11 | 3 | Contains functions related to copying. |
To load the copy module, use |
79 | copy |
copy function |
11 | 3 | Makes a shallow copy. In the copy module. |
To create a copy of an object |
80 | deepcopy |
deep copy function |
11 | 3 | Makes a deep copy. In the copy module. |
To create a copy of an object |
81 | len |
tuple length |
12 | 3 | Produces the length of a tuple. |
The value of |
82 | [i] |
index |
12 | 3 | Produces the item in position |
The value of |
83 | + |
concatenation |
12 | 3 | Produces the tuple formed by gluing together the input tuples. |
The value of |
84 | * |
repeated concatenation |
12 | 3 | Produces the tuple formed by repeatedly gluing the input with copies of the input. |
The value of |
85 | [a:b] |
slice |
12 | 3 | Produces a tuple from positions |
The value of |
86 | tuple |
tuple |
12 | 3 | Produces a tuple from the items in the input. |
The value of |
87 | min |
minimum |
12 | 3 | Produces the minimum item in the tuple. |
The value of |
88 | max |
maximum |
12 | 3 | Produces the maximum item in the tuple. |
The value of |
89 | count |
count |
12 | 3 | Produces the number of times the input item appears in the input tuple. Uses dot notation. |
The value of |
90 | index |
search |
12 | 3 | Produces the smallest index of a position containing the input item in the input tuple. Uses dot notation. |
The value of |
91 | in |
membership |
12 | 3 | Produces |
The value of |
92 | list |
new list |
12 | 3 | Produces a new list containing the items of the input tupleas items. |
The value of |
93 | sorted |
sorted |
12 | 3 | Produces a new list with the tuple input items in sorted order. |
The value of |
94 | [i] |
access dictionary item |
12 | 4 | Produces the value associated with key |
For a variable |
95 | keys |
keys |
12 | 4 | Produces a list of keys in the dictionary. Uses dot notation. |
For a variable |
96 | items |
key, item pairs |
12 | 4 | Produces a list of key, item pairs. Uses dot notation. |
For a variable |
97 | in |
in |
12 | 4 | Produces |
For a variable |
98 | not in |
not in |
12 | 4 | Produces |
For a variable |
99 | zip |
zip |
12 | 4 | Produces pairs of values from two input sequences. |
Using |