filmov
tv
Python 3 Basics #4 | Python Exercise on Lists | List Exercises

Показать описание
Python 3 Basics | Python Exercise on Lists | Exercise # 4
This video contains list of question or hands on exercise for python developers
How to create empty Lists
output - []
How to create a list that contans elements 11,121,1331,14641,161051
output [11,121,1331,14641,161051]
Task No 1
[11,121,1331,14641,161051]
Assign the first element of list1 to the variable first and print it
first = 11
Task No 2
Assign the last element of list1 to the variable last and print it
last = 161051
Task No 3
Assign the second element of list1 to the variable second and print it
second = 121
Task No 4
Append the value 1771561 to list1 and print the list
input - [11,121,1331,14641,161051]
output - [11,121,1331,14641,161051,1771561]
Task No 5
As we know List can hold different data types, we can add list to a list
so add list2 = ['Squares','Cubes','Tetra','Penta','Hexa'] to the existing list list1
input - [11,121,1331,14641,161051,1771561]
output - [11,121,1331,14641,161051,1771561, ['Squares', 'Cubes', 'Tetra', 'Penta', 'Hexa']]
AND
output - [11,121,1331,14641,161051,1771561,'Squares', 'Cubes', 'Tetra', 'Penta', 'Hexa']
Task No 6
Use Insert Method to add the element at an specfied position
Input -- list1 = [11,121,1331,14641,161051]
Output - list1 = [11,121,1000,1331,14641,161051]
Task No 7
To get the index of the List Items
list1 = [11,121,1331,14641,161051]
what is the index of the element 1331 (answer is 2 but how??)
Task No 8
How to add different type of element to my existing list using append method
input - [11,121,1331,14641,161051]
output - [11,121,1331,14641,161051,'Apple']
Task No 9
How to Remove Element of a list using remove() method
input - [11,121,1331,14641,161051]
output - [11,1331,14641,161051]
Task No 10
How to remove the list element using pop() method
input - [11,121,1331,14641,161051]
output - [11,121,1331,14641]
Task No 11
a. How to reverse Python List using reverse() method and
b. without using reverse() method
Task No 12
How to the get the occurence of a element in a list using count() method
Task No 13
How to add the sum of all the element of a list
input - [10,20,30,40,50]
output - 150
Task No 14
Max function to find the largest number in a list
Input - [11, 121, 1000, 1331, 14641, 161051, 5]
Output - 161051
Task No 15
Min function to find the smallest number in a list
Input - [11, 121, 1000, 1331, 14641, 161051, 5]
Output - 5
Task No 16
How to print the alternate elements of a list
Input - [11, 121, 1000, 1331, 14641, 161051, 5]
Output - [11, 1000, 14641, 5]
Output - [11, 1331, 5]
All Playlist of this youtube channel
==============================
1. Data Preprocessing in Machine Learning
2. Confusion Matrix in Machine Learning, ML, AI
3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
4. Cross Validation, Sampling, train test split in Machine Learning
5. Drop and Delete Operations in Python Pandas
6. Matrices and Vectors with python
7. Detect Outliers in Machine Learning
10. Dummy Encoding Encoding in Machine Learning
11. Data Visualisation with Python, Seaborn, Matplotlib
12. Feature Scaling in Machine Learning
13. Python 3 basics for Beginner
14. Statistics with Python
15. Sklearn Scikit Learn Machine Learning
16. Python Pandas Dataframe Operations
17. Linear Regression, Supervised Machine Learning
18 Interview Questions on Machine Learning, Artificial Intelligence, Python Pandas and Python Basics
19. Jupyter Notebook Operations
20. Logistic Regression in Machine Learning, Data Science
21. Learn Microsoft Excel Basics
This video contains list of question or hands on exercise for python developers
How to create empty Lists
output - []
How to create a list that contans elements 11,121,1331,14641,161051
output [11,121,1331,14641,161051]
Task No 1
[11,121,1331,14641,161051]
Assign the first element of list1 to the variable first and print it
first = 11
Task No 2
Assign the last element of list1 to the variable last and print it
last = 161051
Task No 3
Assign the second element of list1 to the variable second and print it
second = 121
Task No 4
Append the value 1771561 to list1 and print the list
input - [11,121,1331,14641,161051]
output - [11,121,1331,14641,161051,1771561]
Task No 5
As we know List can hold different data types, we can add list to a list
so add list2 = ['Squares','Cubes','Tetra','Penta','Hexa'] to the existing list list1
input - [11,121,1331,14641,161051,1771561]
output - [11,121,1331,14641,161051,1771561, ['Squares', 'Cubes', 'Tetra', 'Penta', 'Hexa']]
AND
output - [11,121,1331,14641,161051,1771561,'Squares', 'Cubes', 'Tetra', 'Penta', 'Hexa']
Task No 6
Use Insert Method to add the element at an specfied position
Input -- list1 = [11,121,1331,14641,161051]
Output - list1 = [11,121,1000,1331,14641,161051]
Task No 7
To get the index of the List Items
list1 = [11,121,1331,14641,161051]
what is the index of the element 1331 (answer is 2 but how??)
Task No 8
How to add different type of element to my existing list using append method
input - [11,121,1331,14641,161051]
output - [11,121,1331,14641,161051,'Apple']
Task No 9
How to Remove Element of a list using remove() method
input - [11,121,1331,14641,161051]
output - [11,1331,14641,161051]
Task No 10
How to remove the list element using pop() method
input - [11,121,1331,14641,161051]
output - [11,121,1331,14641]
Task No 11
a. How to reverse Python List using reverse() method and
b. without using reverse() method
Task No 12
How to the get the occurence of a element in a list using count() method
Task No 13
How to add the sum of all the element of a list
input - [10,20,30,40,50]
output - 150
Task No 14
Max function to find the largest number in a list
Input - [11, 121, 1000, 1331, 14641, 161051, 5]
Output - 161051
Task No 15
Min function to find the smallest number in a list
Input - [11, 121, 1000, 1331, 14641, 161051, 5]
Output - 5
Task No 16
How to print the alternate elements of a list
Input - [11, 121, 1000, 1331, 14641, 161051, 5]
Output - [11, 1000, 14641, 5]
Output - [11, 1331, 5]
All Playlist of this youtube channel
==============================
1. Data Preprocessing in Machine Learning
2. Confusion Matrix in Machine Learning, ML, AI
3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
4. Cross Validation, Sampling, train test split in Machine Learning
5. Drop and Delete Operations in Python Pandas
6. Matrices and Vectors with python
7. Detect Outliers in Machine Learning
10. Dummy Encoding Encoding in Machine Learning
11. Data Visualisation with Python, Seaborn, Matplotlib
12. Feature Scaling in Machine Learning
13. Python 3 basics for Beginner
14. Statistics with Python
15. Sklearn Scikit Learn Machine Learning
16. Python Pandas Dataframe Operations
17. Linear Regression, Supervised Machine Learning
18 Interview Questions on Machine Learning, Artificial Intelligence, Python Pandas and Python Basics
19. Jupyter Notebook Operations
20. Logistic Regression in Machine Learning, Data Science
21. Learn Microsoft Excel Basics