Advertisements
Advertisements
प्रश्न
How is an array different from a list?
फरक स्पष्ट करा
Advertisements
उत्तर
An array is a collection of elements of the same data type, whereas a list can contain elements of different data types. Arrays are mainly used for storing and performing operations on numerical data efficiently, while lists are used for storing a general collection of items.
Example:
- Array:
[10, 20, 30, 40] - List:
[10, "Apple", 25.5, True]
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
