Computer Science, asked by mamatasahoo65476, 5 days ago

6. Find the output of the given questions: L1=[1, 2, 3, 4] L2=[5, 6, 7, 8] i. print(L2[2] ii. print(L1+L2) iii. print(len(L1*2)) iv. print(L1[4]) print(L2[-3]) vi. print(L2[:3]) V.

Answers

Answered by ArchBTW
4

Answer:

i: 7

ii: [1, 2, 3, 4, 5, 6, 7, 8]

iii: 8

iv: Will produce error as index out of range

v: 6

vi: [5, 6, 7]

Plz mark it as the brainliest

Answered by Tulsi4890
0

here is an explanation of the output for each question:

  • print(L2[2]): This prints the third element in the list L2, which is 7.

  • print(L1+L2): This concatenates the two lists L1 and L2 and prints the result, which is [1, 2, 3, 4, 5, 6, 7, 8].

  • print(len(L1*2)): This multiplies the list L1 by 2 to create a new list [1, 2, 3, 4, 1, 2, 3, 4], then finds the length of this new list and prints the result, which is 8.

  • print(L1[4]): This tries to access the fifth element in the list L1, which does not exist, so it will result in an error.

  • print(L2[-3]): This accesses the third element from the end of the list L2, which is 6.

  • print(L2[:3]): This accesses the elements in L2 from the beginning up to but not including the fourth element, resulting in a new list [5, 6, 7].

Overall, the output of these statements shows how to access and manipulate elements in a list in Python.

To learn more about list from the given link.

https://brainly.in/question/16088780

#SPJ3

Similar questions