+ 1
How do I use range in lists? (Python)
I've been trying to figure out how to print a section of a list using "range" but it also says "list object is not callable" There is some code below that you can look at and try to explain what I'm doing wrong. https://code.sololearn.com/cSVBV6KRINft/?ref=app
2 Respuestas
+ 4
For list here is a solution:
https://code.sololearn.com/cRDUPHct8q0R/?ref=app
+ 3
You could also use slicing, like this:
list = ["1","2"]
for n in list[0:2]:
print(n)
or
print(' '.join(list[0:2]))
Isn't range used to make lists. And slicing to get parts out of it?