Edit Template
Edit Template
Edit Template

Python List in Hindi

What is Python List in hindi (python me list kya hota hai)

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

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 (python me nested list kya hai)

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

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 me range list kya hai)

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

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 (python me list comprehention kya hai)

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

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 me list indexing kya hai)

अगर हम 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  करते है।

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 me list ke items ko change kaise kare)

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

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 me list ke items ko iterate kaise kare)

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

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 me lists ko add kaise kare)

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

list1 = ["banana", "grapes", "apple"]
list2 = [1, 2, 3]
# Output:
# ['banana', 'grapes', 'apple', 1, 2, 3]

List Methods

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

Syntex:

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

Example:

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

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 करता है।

# 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...

Your email address will not be published. Required fields are marked *

  • 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
Python List

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Python String

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Python Loops

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Hamburger Toggle...

Conditional Statements

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Hamburger Toggle...

Python Operators

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Hamburger Toggle...

Python Data Type

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Hamburger Toggle...

Scikit-learn

Scikit-learn Tutorial Scikit-learn Hamburger Toggle Menu Edit Template Scikit learn What is Scikit-learn Scikit learn एक python library है जिसका...

Pandas

Pandas Tutorial Pandas Hamburger Toggle Menu Edit Template Pandas What is Pandas pandas  एक python library है, जिसका use हम...

NumPy

NumPy Tutorial NumPy Hamburger Toggle Menu Edit Template NumPy What is NumPy matplotlib का use हम data visualization के लिए...

Edit Template
Scroll to Top