List in Python (लिस्ट) :-
List (लिस्ट) Python का एक Built-in Data Type है, जिसका उपयोग एक से अधिक (Multiple) Values को एक ही Variable में Store करने के लिए किया जाता है।
List में समान (Same Type) तथा भिन्न-भिन्न (Different Types) के Data को एक साथ Store किया जा सकता है।
List एक Ordered (क्रमबद्ध), Mutable (परिवर्तनीय) तथा Dynamic (गतिशील) Data Structure है।
Python में List को Square Brackets ([]) के अंदर लिखा जाता है तथा प्रत्येक Element को Comma (,) द्वारा अलग किया जाता है।
महत्वपूर्ण: List Python में सबसे अधिक उपयोग किए जाने वाले Data Types में से एक है।
Syntax -
list_name = [item1, item2, item3, ...]
Example -
English
A List is a Built-in Data Type in Python that is used to store multiple values in a single variable.
A List can store same as well as different types of data together.
A List is an ordered, mutable, and dynamic data structure.
In Python, a List is written inside square brackets ([]), and each element is separated by a comma (,).
Important: A List is one of the most commonly used data types in Python.
Syntax -
list_name = [item1, item2, item3, ...]
Example -
List की आवश्यकता (Need of List) :-
यदि हमें 5 विद्यार्थियों के नाम Store करने हों, तो बिना List के 5 अलग-अलग Variables बनाने होंगे।
If we want to store the names of five students, we need five separate variables without using a List.
List एक Ordered (क्रमबद्ध) Data Type है। इसमें Elements उसी क्रम (Order) में Store रहते हैं, जिस क्रम में उन्हें List में जोड़ा जाता है। प्रत्येक Element का एक निश्चित Index Number होता है, जिससे उसे आसानी से Access किया जा सकता है।
EnglishA List is an ordered data type. The elements are stored in the same order in which they are inserted into the List. Each element has a fixed index number, making it easy to access.
Example-List Mutable (परिवर्तनीय) होती है। इसका अर्थ है कि List बनने के बाद भी उसके Elements को बदला (Modify), जोड़ा (Add) या हटाया (Remove) जा सकता है।
EnglishA List is mutable, which means its elements can be modified, added, or removed even after the List is created.
Example -List में एक ही Value को एक से अधिक बार Store किया जा सकता है। Python Duplicate Values को हटाता नहीं है, बल्कि उन्हें उसी क्रम में Store करता है।
EnglishA List allows duplicate values. The same value can appear multiple times in a List.
Example -List में अलग-अलग प्रकार (Different Types) के Data जैसे Integer, Float, String, Boolean, List आदि को एक साथ Store किया जा सकता है।
EnglishA List can store different types of data such as Integer, Float, String, Boolean, and even another List.
Example -5. Dynamic Size (गतिशील आकार) -
List का आकार (Size) निश्चित नहीं होता। आवश्यकता अनुसार इसमें नए Elements जोड़े या हटाए जा सकते हैं।
EnglishA List has a dynamic size. Elements can be added or removed whenever required.
Example -List का प्रत्येक Element 0 से शुरू होने वाले Index Number द्वारा पहचाना जाता है। Index की सहायता से किसी भी Element को सीधे Access किया जा सकता है।
EnglishEach element in a List has an index number starting from 0. Indexing allows direct access to any element.
Example -7. Supports Negative Indexing (नेगेटिव इंडेक्सिंग का समर्थन) -
List में Negative Indexing भी होती है। इसमें गिनती List के अंतिम Element से शुरू होती है।
A List also supports negative indexing, where counting starts from the last element.
Example -
List में Slicing की सहायता से एक साथ कई Elements प्राप्त किए जा सकते हैं।
EnglishA List supports slicing, which allows retrieving multiple elements at once.
Example -9. Can Store Nested Lists (नेस्टेड लिस्ट को Store कर सकती है) -
यदि किसी List के अंदर दूसरी List हो, तो उसे Nested List कहते हैं।
EnglishA List can contain another List. Such a List is called a Nested List.
Example -10. Iterable (इटेरेबल) -
List के प्रत्येक Element पर एक-एक करके for Loop या while Loop की सहायता से कार्य किया जा सकता है।
EnglishA List is iterable, meaning each element can be accessed one by one using loops such as for or while.
Example -