Python Basics # 4 | List Operations | append | extend | sort | remove | delete | slicing in python

Publié le: 08 septembre 2018
sur la chaîne: technologyCult
1,072
16

Python Basics # 4 | List Operations | append | extend | sort | remove | delete | slicing in python

Python List Operations

Python Basics - Session No 4

Topic to be covered - List in Python

Code Starts Here
==============

list1 = [1,2,3,4,'Hi','Hello','Bye',3.14,33.6,True]

list1 = [1,2,3,4,'Hi','Hello','Bye',3.14,33.6,True,[4,5,6]]

How to reference a List
list1[6]

list1[-1][0]

Slicing in Python List
list [ number : n - 1]

list1[ 3 : 8 ]
list1[ 3 : 7 ]

How to get the index of a partticular element

list1.index('Bye')
list1.index(3)

Count the items
len(list1)

tuple1 = (1,2,3,4)

list2 = [1,2,3,4,'Hi','Hello','Bye',3.14,33.6,True,[4,5,6],(1,2,3,4)]


lista = [1,2,3]
listb = ['a','b','c']

listc = [1,2,3]
listd = ['a','b','c']

listc = lista + listb

print(listc)

Change the list

listc[4] = 'x'

Difference between Append and Extend in List

lista.append(listb)
print(lista)

listc.extend(listd)
print(listc)

Delete operations in List

del listc[1]

listc.remove('a')

Aliasing in Python

x = ['A','B','C']
y = x

x.extend('D')

z = x[:]

x.append('E')

lists = [8,7,5,4,3,2,10,0,1]
lists.sort()

list_string=['Venkat','Maneesh','Majid','Shwetha','Sonali','Mohsin']
list_string.sort()
print(list_string)


All the playlist of this youtube channel
========================================

1. Data Preprocessing in Machine Learning
   • Data Preprocessing in Machine Learning| Li...  

2. Confusion Matrix in Machine Learning, ML, AI
   • Confusion Matrix in Machine Learning, ML, AI  

3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
   • Anaconda | Python Installation | Spyder | ...  

4. Cross Validation, Sampling, train test split in Machine Learning
   • Cross Validation | Sampling | train test s...  

5. Drop and Delete Operations in Python Pandas
   • Drop and Delete Operations in Python Pandas  

6. Matrices and Vectors with python
   • Matrices and Vectors with python  

7. Detect Outliers in Machine Learning
   • Detect Outliers in Machine Learning  

8. TimeSeries preprocessing in Machine Learning
   • TimeSeries preprocessing in Machine Learning  

9. Handling Missing Values in Machine Learning
   • Handling Missing Values in Machine Learning  

10. Dummy Encoding Encoding in Machine Learning
   • Label Encoding, One hot Encoding, Dummy En...  

11. Data Visualisation with Python, Seaborn, Matplotlib
   • Data Visualisation with Python, Matplotlib...  

12. Feature Scaling in Machine Learning
   • Feature Scaling in Machine Learning  

13. Python 3 basics for Beginner
   • Python | Python 3 Basics | Python for Begi...  

14. Statistics with Python
   • Statistics with Python  

15. Data Preprocessing in Machine Learning
   • Data Preprocessing in Machine Learning| Li...  

16. Sklearn Scikit Learn Machine Learning
   • Sklearn Scikit Learn Machine Learning  

17. Linear Regression, Supervised Machine Learning
   • Linear Regression | Supervised Machine Lea...  


Sur cette page du site, vous pouvez voir la vidéo en ligne Python Basics # 4 | List Operations | append | extend | sort | remove | delete | slicing in python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur technologyCult 08 septembre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,072 fois et il a aimé 16 téléspectateurs. Bon visionnage!