I've been searching for quite a while, and I can't seem to find the answer to this. I want to know if you can use variables when using the range() function. For example, I can't get this to work:
l=raw_input('Enter Length.')
#Let's say I enter 9.
l=9
for i in range (0,l):
#Do something (like append to a list)
Python tells me I cannot use variables when using the range function. Can anybody help me?
raw_input, it is a string. Cast it to anint.int(raw_input('Enter Length.')), so the exact term is not "Cast", but "Convert it to an integer", or "Construct an integer out of it".