Linked Questions

Popular Questions

Should I store len(list) somewhere?

Asked by At

code1:

list=[1,2,3,4,5]
for i in range(len(list)):
    for j in range(len(list)):
        print(i+j)

code2:

list=[1,2,3,4,5]
l=len(list)
for i in range(l):
    for j in range(l):
        print(i+j)

Dose code2 faster than code1?

Related Questions