Home >> Python Tutorial >> Python List
Edit Template
Edit Template

Python List in Hindi

What is Python List in hindi

Python List in hindi : python में list बनाने के लिए हम square bracket का use करते हैं, और उनके अंदर values को comma से  separate करके Store करते हैं. जैसा की example में दिया गया है

🐍
lists.py
Copy to clipboard
number_list = [5, 48, 9, 789, 0, 45]
string_list = ["mango", "banana", "apple"]
mixed_list = ["apple", 56, True, 2.8]
empty_list = []

print(number_list)
print(string_list)
print(mixed_list)
print(empty_list)

# output:
# [5, 48, 9, 789, 0, 45]
# ['mango', 'banana', 'apple']
# ['apple', 56, True, 2.8]
# []

What is Nested List in python in hindi

अगर हम list केअंदर list बनाते हैं तो इसे nested list कहा जाएगा. for Example

🐍
nested list.py
Copy to clipboard
nested_list = [[5,8],[4,1],[2,8]]
print(nested_list)
# Output:
# [[5,8],[4,1],[2,8]]

what is range list in python in hindi

python मे range() एक method होता है, जिसके help से हम python List को create कर सकते है। जो list range() method के help से create किया जाता है उन्हे range list कहा जाता है।

🐍
range list.py
Copy to clipboard
num = list(range(1, 10))
print(num)
# Output:
# [1, 2, 3, 4, 5, 6, 7, 8, 9]

what is list comprehension in python in hindi

pythhon मे list comprehension एक तरीका है list create करने का 

🐍
create a list.py
Copy to clipboard
comprehension_list = [a**2 for a in range(1, 6)]
print(comprehension_list)
# Output:
# [1, 4, 9, 16, 25]

what is list indexing in python in hindi or how to access list items

अगर हम python list मे से किसी particular item को access करना चाहते है तो indexing का use करते है। indexing positive और negative दोनों तरीके से की जा सकती है। positive indexing मे list के first item को access करने के लिए “0” का use करते है और negative indexing मे list के last item को access करने के लिए “-1” का use  करते है।

🐍
list indexing.py
Copy to clipboard
my_list = ["banana", "grapes", "apple"]
print(my_list[0])
print(my_list[-1])
# Output:
# banana
# apple

how to change list items in python in hindi

python मे हम list के items को direct assignment के through change कर सकते है। list के जिस भी item को change करना उसे indexing के through select किया जाता है। 

🐍
adding item.py
Copy to clipboard
my_list = ["banana", "grapes", "apple"]
my_list[1] = "orange"
print(my_list)
# Output:
# ['banana', 'orange', 'apple']

how to iterate list items in python in hindi

python मे हम list के items को for loop के through iterate कर सकते है। 

🐍
iterate items.py
Copy to clipboard
my_list = ["banana", "grapes", "apple"]
for i in my_list:
    print(my_list)
# Output:
# ['banana', 'grapes', 'apple']

how to add lists in python in hindi

python मे हम “+” operator का use करके lists को आसानी से add  कर सकते है।

🐍
adding lists.py
Copy to clipboard
list1 = ["banana", "grapes", "apple"]
list2 = [1, 2, 3]
print(list1 + list2)
# Output:
# ['banana', 'grapes', 'apple', 1, 2, 3]

List Methods in Hindi

python मे list के लिए कई सारे build-in methods होते है.

Syntex:

method को किसी भी variable के साथ use करने के लिए dot ( . ) का use करते है।

Example:

append() : इस method का use करके हम string के सभी lower case letters को upper case मे कर सकते है। 

🐍
append.py
Copy to clipboard
list1 = ["banana", "grapes", "apple"]
list1.append("orange")
print(list1)
# Output:
# ['banana', 'grapes', 'apple', 'orange']

यहाँ कुछ list के methods दिए गए है जिन्हे आप इसी तरह से list के साथ use करके इनके result को देख सकते है।

append(): नए element को list के end मे add करता है। 

insert(): नए element को specified index पर insert करता है।

remove(): किसी Specified value को list मे से remove करता है।

pop(): किसी Specified index परर element को remove करता है।

index(): किसी Specified value का first occurrence का index return करता है। 

count(): किस Specified value का occurrences count करता है।

sort(): List के elements को sort करता है।

reverse(): List के elements को reverse करता है।

🐍
list methods.py
Copy to clipboard
# Ek empty list banate hain
my_list = []

# 1. append() - End me elements add karte hain
my_list.append(10)
my_list.append(20)
my_list.append(30)
print("After append:", my_list)  # [10, 20, 30]

# 2. insert() - Specific index par element insert karte hain
my_list.insert(1, 15)  # Index 1 par 15 insert hoga
print("After insert:", my_list)  # [10, 15, 20, 30]

# 3. remove() - Specific value ko remove karte hain
my_list.remove(20)
print("After remove:", my_list)  # [10, 15, 30]

# 4. pop() - Specific index se element remove aur return karte hain
removed_element = my_list.pop(1)  # Index 1 ka element hataenge
print("Popped element:", removed_element)  # 15
print("After pop:", my_list)  # [10, 30]

# 5. index() - Kisi value ka first index find karte hain
index_of_30 = my_list.index(30)
print("Index of 30:", index_of_30)  # 1

# 6. count() - Kisi value ka count nikalte hain
count_of_10 = my_list.count(10)
print("Count of 10:", count_of_10)  # 1

# 7. sort() - List ko ascending order me sort karte hain
my_list.append(5)
my_list.append(25)
print("Before sort:", my_list)  # [10, 30, 5, 25]
my_list.sort()
print("After sort:", my_list)  # [5, 10, 25, 30]

# 8. reverse() - List ko reverse karte hain
my_list.reverse()
print("After reverse:", my_list)  # [30, 25, 10, 5]

उम्मीद करते है कि आपको python list अच्छे समझ मे आ गया होगा । अपने learning को continue रखने के लिए next button पर click करे,

Add a comment...

  • All Posts
  • Artificial Intelligence
  • Computer Fundamentals
  • Computer Networks
  • Data Analytics
  • Data Science
  • DBMS
  • Deep Learning
  • Digital Fundamentals
  • DSA with Python
  • Excel
  • Exercise
  • Git & Github
  • Machine Learning
  • Matplotlib
  • Natural Language Processing
  • NumPy
  • Operating System
  • Pandas-s
  • Power BI
  • Python Tutorial
  • Scikit-learn
  • Seaborn
  • SQL & MySQL
File Pointer

Table of Contents All Chapters 1. File Pointer 2. File Pointer Methods      2.1. tell() Method      2.2....

File Handling

Table of Contents All Chapters 1. File Handling 2. Types of File 3. open() and close() Methods 4. File Modes...

Python Modules

Table of Contents All Chapters 1. Modules in Python 2. Pre-defined Modules      2.1. math      2.2. random...

Python Iterators

Table of Contents All Chapters 1. Iterators      1.1. Iterable      1.2. Iterator      1.3. Iterator Protocol...

Python Polymorphism

Table of Contents All Chapters 1. Polymorphism 2. Key Concepts of Polymorphism 3. Types of Polymorphism      3.1. Polymorphism...

Python Inheritance

Table of Contents All Chapters 1. Inheritance 2. Concepts of Inheritance 3. Types of Inheritance      3.1. Single Inheritance...

Python Function

Table of Contents All Chapters 1. Python Function 2. Define Function 3. Function Arguments 4. Function Parameters 5. Local and...

Python Dictionary

Table of Contents All Chapters 1. Python Dictionary 2. Access Dictionary items 3. Change Dictionary items 4. Add items in...

Edit Template
Scroll to Top