+ 2
This simple piece of code wont work for me! where have i gone wrong?
this simple piece of code wont work for me: start = [range(0, 40)] for word in start: print(word) print(">End<") Please help! thanks!
4 Answers
+ 3
You can also just omit the brackets, then start contains the range-object.
start = range(0, 40)
for word in start:
print(word)
print(">End<")
+ 4
start = range(0, 40)
Since range returns a list by default there is no need for the brackets.
+ 4
+ 1
I have 2 simple solutions:
#By list comprehension:
start = [i for i in range(0, 40)]
for word in start:
print(word)
print(">End<")
#By list function:
start = list(range(0, 40))
for word in start:
print(word)
print(">End<")