2

If I were to do

age, height = 16, 1.24

would that be faster than

age = 16
height = 1.24

It would be a very small difference, but I imagine if you are declaring many variables, that time will add up.

1 Answers1

1
import timeit

code1 = 'age, height = 16, 1.24' 
code2 = '''age = 16
height = 1.24'''

print (timeit.timeit(stmt = code1, number = 1)) 
print (timeit.timeit(stmt = code2, number = 1)) 

I think declaring each variable separately would be much faster. Try seeing that with the help of the code above.

R M
  • 21
  • 3