Web app services are now focused now on Python as it is easy to do numerical calculations in scientific-related applications.
There are two types of data structures in Python i.e. Lists and Tuples.
Both are different in their working as listed below:
-
A List is a group of comma separated values in square brackets and have similar data types.
The content in the list are mutable and any change can be performed once after the List Object is created.
E.g., i= [1,2, 3, 4, 5, 6]
It is used if the group of data doesn’t need random access and frequent data modification is required.
-
A Tuple is a group of Comma Separated Values enclosed in round brackets or parenthesis. The contents in the list are immutable and change cannot be performed once after the List Object is created.
e.g., t = (10, 20, 30, 40)
t[1]=35 will return the unsupported item assignment as ValueError
It is combined with dictionary to represent a key and when the data doesn’t require modification.
Post a Comment