Welcome to the Treehouse Community
Looking to learn something new?
Sanjay DevadkarCourses Plus Student 1,016 Points
how to slice word from list
suppose i have below list and i want to get word 3, 4th and 7th from the list. how to get that is single line.
example of list:- continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia']
Alex KoumparosPython Development Techdegree Student 36,862 Points
I'm not sure why you'd want to do this, but in your example you could write:
sliced = continents[2:4] + [continents]