+ 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

13th Feb 2018, 8:04 AM
Zack
Zack - avatar
2 Réponses
+ 4
13th Feb 2018, 8:56 AM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 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?
13th Feb 2018, 9:16 AM
Paul
Paul - avatar