Is there a way to access a tuple with subscript syntax (like array or dictionary) rather than using dot syntax?
It’s virtually impossible with subscript (you could potentially do a lot of loops to simulate it virtually, but to no end). Accessing with the dot operator is the way, and if you really need subscripts then you are probably in need of a different data type instead.
If you have a tuple, and you’re not sure what index you’ll be applying with dot syntax, … is there a way to do something like
tuple.x inside of a loop (where the
x is the iterator placeholder)?
It gets dicey, the assumption here is that you’re iterating over a tuple which is not always the way to go. You can however, look up ways to iterate a tuple to see how it might be done for reference.