8Tuples
The good thing about covering lists is that it then makes tuples much easier to cover. Tuples are essentially lists. You access them in exactly the same way and many things we covered in lists are relevant to tuples, the big difference is tuples can't be modified. Why would you want something that cannot be modified? Well its actually more useful than you would think, it prevents you from accidentally changing something that you may rely on in your code.
Let's take the numbers list we defined at the start of the list section:
We can rewrite this as a tuple as follows:
Looks very similar doesn't it! Now let's try and access the first element of the tuple, again we do it in the same way as we would do in a list
And to get the last number we would do
We can splice the tuple just like we would a list, so if we wanted everything except the last two values then we do it in exactly the same way we would do in a list
So what is the point in tuples? Well let's try and change ...