English

How is an array different from a list?

Advertisements
Advertisements

Question

How is an array different from a list?

Distinguish Between
Advertisements

Solution

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
  Is there an error in this question or solution?
Chapter 6: Introduction to NumPy - Exercise [Page 113]

APPEARS IN

NCERT Informatics Practices [English] Class 11
Chapter 6 Introduction to NumPy
Exercise | Q 2. b) | Page 113
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×