Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Python-Data-Structure

Week 2 assignment on python programming

Initialize an empty list

my_list = []

Append elements to the list

my_list.append(10) my_list.append(20) my_list.append(30) my_list.append(40)

Insert 15 at index 1

my_list.insert(1, 15)

Extend the list with additional elements

my_list.extend([50, 60, 70])

Remove the last element

my_list.pop()

Sort the list in ascending order

my_list.sort()

Find the index of the element 30

index_of_30 = my_list.index(30) print("Index of 30:", index_of_30)

Print the final state of the list

print("Final list:", my_list)

About

Week 2 assignment on python programming

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors