I am wondering how to put a tuple into an array? or is it better to use arrays in array for the design of the program rather than a tuple in an array?
please advice me. thank you
I am wondering how to put a tuple into an array? or is it
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One thing to keep in mind is that a tuple is immutable. This means that once it’s created, you can’t modify it in-place. A list, on the other hand, is mutable — meaning you can add elements, remove elements, and change elements in-place. A list has extra overhead, so only use a list if you need to modify the values.
You can create a list of tuples:
or a list of lists:
The difference is that you can modify the elements in the list of lists:
but not with the list of tuples:
To iterate over a list of tuples: