Questions tagged [variable-names]
256 questions
-6
votes
2 answers
quotation marks needed for variable name in timeit moduel, python3
import random
import timeit
data = [random.randint(-10,10) for i in range(10)]
timeit.timeit('filter(lambda x : x>=0 ,"data")')
As shown in the code.
if I try to remove the "" from "data", it would throw an error.
Why?
There is still a single…

Charlie Li
- 1
- 2