0% found this document useful (0 votes)
8 views

Python-Cheat-Sheet-PDF

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Python-Cheat-Sheet-PDF

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Cheat Sheet for Developers

Python Cheat Sheet for Coder

No. Action Python Code Section


1 Boolean True/False Main Python Data Types
2 Integer 10 Main Python Data Types
3 Float 10.01 Main Python Data Types
4 String “123abc” Main Python Data Types
5 List [value1, value2, …] Main Python Data Types
6 Dictionary {key1:value1, key2:value2, …} Main Python Data Types
7 Prints x objects separated by y print(x, sep='y') Python Built-in Function
8 Prints s and waits for an input that will be returned input(s) Python Built-in Function
9 Returns the length of x (s, L or D) len(x) Python Built-in Function
10 Returns the minimum value in L min(L) Python Built-in Function
11 Returns the maximum value in L max(L) Python Built-in Function
12 Returns the sum of the values in L sum(L) Python Built-in Function
13 Returns the absolute value of n abs(n) Python Built-in Function
14 Returns the n1 number rounded to n digits round(n1, n) Python Built-in Function
15 Comment # Python Special Characters
16 New line \n Python Special Characters
17 Scape char \ Python Special Characters
18 Retrieves character at position i string[i] Python String Operations
19 Retieves last character string[-1] Python String Operations
20 Retrieves characters in range i to j string[i:j] Python String Operations
21 Defines an empty list list=[] Python List Operations
22 Stores x with index i list[i]=x Python List Operations
23 Retrieves the item with index i list[i] Python List Operations
24 Retrieves last item list[-1] Python List Operations
25 Retrieves items in the range i to j list[i:j] Python List Operations
26 Removes the item with index i del list[i] Python List Operations
27 Addition + Python Numeric Operations
28 Subtraction – Python Numeric Operations
29 Multiplication * Python Numeric Operations
30 Division / Python Numeric Operations
31 Exponent ** Python Numeric Operations
32 Modules % Python Numeric Operations
33 Floor division // Python Numeric Operations
34 Equal == Python Comparison Operations
35 Different != Python Comparison Operations
36 Higher > Python Comparison Operations
37 Lower < Python Comparison Operations
38 Higher or equal >= Python Comparison Operations
39 Lower or equal <= Python Comparison Operations
40 Defines an empty dictionary dict={} Python Dictionary & Boolean Operations
41 Stores x associated to keys k dict[k] = x Python Dictionary & Boolean Operations
42 Retrieves the item with keys k dict[k] Python Dictionary & Boolean Operations
43 Removes the item with keys k del dict[k] Python Dictionary & Boolean Operations
44 Logical AND and Python Dictionary & Boolean Operations
45 Logical OR or Python Dictionary & Boolean Operations
46 Logical NOT not Python Dictionary & Boolean Operations
47 Converts to uppercase string.upper() Python String Methods
48 Converts to lowercase string.lower() Python String Methods
49 Counts how many times x appears string.count(x) Python String Methods
50 Position of the x first occurence string.find(x) Python String Methods
51 Replaces x for y string.replace(x,y) Python String Methods
52 Returns a list of values delimited by x string.strip(x) Python String Methods
53 Returns a string with L values joined by string string.join(L) Python String Methods
54 Returns a string that includes formatted x string.format(x) Python String Methods
55 Adds x to the end of the list list.append(x) Python List Methods
56 Appends L to the end of the list list.extend(L) Python List Methods
57 Inserts x at i position list.insert(i,x) Python List Methods
58 Removes the first list item whose value is x list.remove(x) Python List Methods
59 Removes the item at position i and returns its value list.pop(i) Python List Methods
60 Removes all items from the list list.clear() Python List Methods
61 Returns a list of values delimited by x list.index(x) Python List Methods
62 Returns a string with list values joined by S list.count(x) Python List Methods
63 Returns a list of keys dict.keys() Python Dictionary Methods
64 Returns a list of values dict.values() Python Dictionary Methods
65 Returns a list of pairs dict.items() Python Dictionary Methods
66 Returns the value associtated to the keys k dict.get(k) Python Dictionary Methods
67 Removes the item associated to the keys and returns its value dict.pop() Python Dictionary Methods
68 Adds keys-values to dictionary dict.update(D) Python Dictionary Methods
69 Removes all keys values from the dictionary dict.clear() Python Dictionary Methods
70 Returns a copy of the dictionary dict.copy() Python Dictionary Methods

learn more - https://tutorialtactic.com/keyboard-shortcuts/python-cheat-sheet/

You might also like