How to use lists in python | Full Python Course in Hindi by Hey Sushil
hey sushil के इस विडिओ WHAT IS LIST IN PYTHON मे पाइथान लिस्ट क्या है और उसमे क्या कैसे काम करता है और उसके साथ कई सारे पॉइंट्स पर बात किया हूँ:
- WHAT IS LIST IN PYTHON?
- KYA LIKST AUR ARRAY EK HI HAIN?
- LIST KA KAISE USE KIYA JAYE?
- PYTHON ME LIST KITNA IMPORTANT HAI?
- PYTHON LIST ME KITNE SUB METHODS HAI?
- PYTHON LIST ME SUB METHODS KE USE?
Python Collections (Arrays) | |
There are four collection data types in the Python programming language: | |
You need to understand all | |
List is a collection which is ordered and changeable. Allows duplicate members. | |
Tuple is a collection which is ordered and unchangeable. Allows duplicate members. | |
Set is a collection which is unordered and unindexed. No duplicate members. | |
Dictionary is a collection which is unordered, changeable and indexed. No duplicate members. |
newlist = ['list','tuple','set','dictionay']
print('\nNew LIst => ',newlist)
'''
list
new vale add kar sakete hai
current value ko change
curernt value ko remove kar sakte hai
'''
print('\nList 1st possition => ',newlist[1])
print('\nList 1st possition => ',newlist[-1])
# Range of Indexes
print('\nList 1st possition => ',newlist[1:3])
print('\nList 1st possition => ',newlist[-3:-1])
print('\nList 1st possition => ',newlist[1:])
print('\nList 1st possition => ',newlist[:3])
# Change Item Value
newlist[0] = 'new list'
print('\nNewlist value[0] => ',newlist[0])
# List Length
print('\nLen => ',len(newlist))
print('\nOld List => ',newlist)
# Add Items
newlist.append('Conditon')
# inset
newlist.insert(0,'list')
# Remove Item
newlist.remove('Conditon')
# pop()
newlist.pop()
# Copy a List
copylist = newlist.copy()
print('\nNew List Value => ',newlist)
# del
del newlist
# newlist = ['new list', 'tuple', 'set', 'dictionay']
# clear
secondlist = copylist.copy()
copylist.clear()
print('\nCopy List Value => ',copylist)
print('\nSecond List Value => ',secondlist)
# Join Two Lists
joinlist = ['join','new','list data']
secondlist.extend(joinlist)
print('\nJoin List => ',secondlist)