Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialkosi Ofodum
192 PointsCreate a variable called item3 and assign to it the third element in my_tuple?
how do i do this
my_tuple = 'I', 'love', 'python'
1 Answer
Steven Tagawa
Python Development Techdegree Graduate 14,438 PointsHonestly, I had to re-read this challenge a couple of times to figure out what they were asking... They just want you to take the third item in the tuple (which is 'python') and put it in a new variable called 'item3'. So you start with
item3 =
You get to items in a tuple the same way you do with lists, with brackets [] and remember that it starts at zero, so the third item is [2]. So you end up with
item3 = my_tuple[2]