+ 1
Printing only certain amount of items in list on python 3
It's probably a very dumb question to ask but i can't find answer anywhere else. Lets say i have a list [1,2,3,4,5,6,7,8,9] is there any way i can print only 6 items without using index? the answer should be like [1,2,3,4,5,6]
2 Réponses
+ 6
Slicing
yourlist[:6]
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453/
+ 1
Oooh now i get it, thanks!