Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

code optimization in python

HOW TO WRITE BETTER CODE IN PYTHON | TIP #1

1 - List comprehension
#DONT DO THIS:

list = []
for i in range(number):
    list.append(i)
    
#DO THIS:

list = [i for i in range(number)]
 
PREVIOUS NEXT
Tagged: #code #optimization #python
ADD COMMENT
Topic
Name
5+2 =