python Create a list and do the following using python: Declare a list with the following values initially: SZABIST, 2021, BSCS, BSMS, Karachi, Islamabad, Larkana, Hyderabad, MSCS, A, B, C, D, Batch, 100, 200, 300.3 Find out the length of the list Print list between range of third element to second last (2nd last element) Insert “wishing you a new year” on index 3 in the list Insert the following a value in the list in the following format “Your full name – your father’s name” Delete 2nd value from the list and also delete “batch” Print the final list
Types of Linked List
A sequence of data elements connected through links is called a linked list (LL). The elements of a linked list are nodes containing data and a reference to the next node in the list. In a linked list, the elements are stored in a non-contiguous manner and the linear order in maintained by means of a pointer associated with each node in the list which is used to point to the subsequent node in the list.
Linked List
When a set of items is organized sequentially, it is termed as list. Linked list is a list whose order is given by links from one item to the next. It contains a link to the structure containing the next item so we can say that it is a completely different way to represent a list. In linked list, each structure of the list is known as node and it consists of two fields (one for containing the item and other one is for containing the next item address).
python
- Create a list and do the following using python:
- Declare a list with the following values initially: SZABIST, 2021, BSCS, BSMS, Karachi, Islamabad, Larkana, Hyderabad, MSCS, A, B, C, D, Batch, 100, 200, 300.3
- Find out the length of the list
- Print list between range of third element to second last (2nd last element)
- Insert “wishing you a new year” on index 3 in the list
- Insert the following a value in the list in the following format “Your full name – your father’s name”
- Delete 2nd value from the list and also delete “batch”
Print the final list
Step by step
Solved in 2 steps