0
Printing 2 parts of a list
If I have a list and want to print 2 parts, is there an easier way to print them than this? list = [1,2,3,4] print(list[1], list[2])
3 Respostas
0
hardly, actually. But be careful with your indexes, I just want to make sure you really want to print the second and third items in that list ?
0
Yeah I know it would be the 2nd and 3rd items in the list. Thanks for the response, I'm kind of surprised there isn't a shortcut there.
0
maybe using list[1:3] but you end up with a list, so it prints as a list... There is no shortcut that I know of, sadly...