Tutorial #19 || Lists in Python || Python Data Structures || Python Tutorials for Beginners

Опубликовано: 21 Октябрь 2024
на канале: Haripriya Manne
91
6

Tutorial #18 || Python Iterations || For Loop || While Loop || Python Tutorials for Beginners video link:    • Tutorial #18 || Python Iterations || ...  

Tasks:
● Take a list of elements and add that list into another empty list 
● Sort the list of elements in ascending order and descending order. 
● Given a two list of equal size create a set such that it shows the element from both  lists in the pair. 
● Write a python program to print the sum and average of elements in the list. 

List Methods:
append( )  Adds an item at the end of the list 
Example: L1.append( 22 )  Result: L1 = [ 1, 2, 3, 22 ] 

extend( )  Adds one entire list into another list. 
Example: L1.extend( L2 )  Result: L1 = [ 1, 2, 3, 10, 20, 30 ] 

copy( )  Returns the copy of list 
Example: List1 = L1.copy( )  Result: List1 = [ 1, 2, 3 ] 

count( )  Returns the count of elements in list 
Example: L3.count( 12 )  Result: 3 

index( )  Returns the index position of particular value in the list 
Example: L2.index( 30 )  Result: 2 

insert( )  Adds an item at a particular position in the list 
Example: L1.insert( 2, “Python” )  Result: L1 = [ 1, 2, “Python”, 3 ] 

pop( )  Removes an item at the end of the list 
Example: L1.pop( )  Result: L1 = [ 1, 2 ] 

remove( )  Removes an item at a particular position of the list 
Example: L2.remove( 20 )  Result: L2 = [ 10, 30 ] 

reverse( )  Reverse the items in list 
Example: L3.reverse( )  Result: L3 = [ 12, 28, 12, 25, 12, 19 ] 

sort( )  Sorts the items in ascending order  Example: L3.sort( ) 
Result: L3 = [ 12, 12, 12, 19, 25, 28 ]  

clear( )  Removes all elements in the list 
Example: L1.clear( ) Result: [ ] 

Follow Python Tutorials:    • Python Tutorials for Beginners  

If you want to develop games than don't be late visit this playlist almost 40 Tutorials made just learn by using below lin
Follow Unity 2D Game Development Creepy Cat Tutorials:
   • Unity 2D Game Development Creepy Cat ...  

Follow me on:
► Subscribe to my Channel:    / haripriyamanne  
►Instagram:   / haripriya_manne  
►Website: http://haripriyamanne.byethost10.com/...

If you have any queries can mail me to
[email protected]

Music:
https://www.jiosaavn.com/song/family-...
https://wynk.in/music/song/family-day...

Disclaimer- All videos and content used for educational purpose