CBSE Class 12 Sample Paper for 2024 Boards

Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

## (i) To insert an element 200 at the third position, in the list L1.

The Python statement for inserting an element 200 at the third position in the list L1 is:

``` L1.insert(2,200) ```

To write the Python statement for inserting an element 200 at the third position in the list L1, we need to understand the following concepts:

• Lists are collections of values that can be of different types. For example, L1=[10,20,30,40] is a list of four integers. We can also access the elements of a list by using indexing, similar to strings. For example, L1 is 10, L1 is 20, and so on.
• insert() is a method that inserts an element at a specified position in a list. The syntax of insert() is list.insert(index,element)
• where index is the position where the element will be inserted
• element is the value to be inserted.
• The index starts from 0, so the first position is 0, the second position is 1, and so on.

Therefore, the Python statement for inserting an element 200 at the third position in the list L1 is:

``` L1.insert(2,200) ```

Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class 