Malcolm Aldrin Masumba3,689 Points
How do i assign a variable to an element in a tuple
Where exactly am i going wrong
Chris Kisselburgh2,173 Points
Remember that tuples are immutable meaning they can't be modified once the data is stored inside of one. With that in mind, you access items in tuples using their position index inside of square brackets.
my_tuple = ('dog', 'cat', 'bird') print(my_tuple)
This code should return the string 'cat' as the position index in python always starts at the number 0. Instead of printing the variable like I did in my example, you could just assign it to a new variable as well.
Hope this helps!