Ask Question

What are two reasons why tuples exist in Python?

+4
Answers (1)
  1. 22 July, 16:01
    0
    A tuple is a sequence of grouped values. It serves to group, as if they were a single value, several values that, by their nature, must go together. The tuple type is immutable. A tuple cannot be modified once it has been created.

    One of the reasons why there are tuples in phyton is that they are generally used to determinate that their content is not modified. They constitute a type of data widely used in the definition and call of functions and in other situations where it is necessary to use the capacity of tuples to be packaged and unpacked. The benefits of immutability are simplicity, reduced demand for storage space and high performance in processing, issues that exceed the lists.

    Another reason why there are tuples on python is that tuples are faster than lists. If a constant set of values is defined and all that is going to be done is to iterate over them, it is better to use a tuple instead of a list.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What are two reasons why tuples exist in Python? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers