No products in the cart.

Predict the output: l1=[500, 600] l2=[35, …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Predict the output: l1=[500, 600] l2=[35, 45] l1.append(700) l1.extend(l2) l1.insert(25, 2) print(l1) print(l1+l2) print(l1.idex(35)) print(l2*2)
  • 3 answers

Tec Om 3 years, 11 months ago

<pre>l1=[500, 600] l2=[35, 45] l1.append(700) l1.extend(l2) l1.insert(2,25) print(l1) print(l1+l2) print(l1.index(35)) print(l2*2) sorry this is your desired code</pre>

Tec Om 3 years, 11 months ago

<pre>the correct code is '' l1=[500, 600] l2=[35, 45] l1.append(700) l1.extend(l2) l1.insert(2,25) print(l1) print(l1+l2) print(l1.index(35)) print(l2*2)l1=[500, 600] l2=[35, 45] l1.append(700) l1.extend(l2) l1.insert(2,25) print(l1) print(l1+l2) print(l1.index(35)) print(l2*2)</pre>
the output is :
<pre> [500, 600, 25, 700, 35, 45] [500, 600, 25, 700, 35, 45, 35, 45] 4 [35, 45, 35, 45]</pre>

Tec Om 3 years, 11 months ago

if the code is as is it is then you will find error at "insert (25,2)" because 25 index is not present in l1 and at idex this is not any method index is the method
http://mycbseguide.com/examin8/

Related Questions

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App