What will be the output of below code and why x 1 2 3 4 5 print x insert 2 3

0 votes

What will be the output of the below code and why?
 

x=[1,2,3,4,5]

print(x.insert(2,3))
Oct 14, 2020 in Python by anonymous
• 10,520 points
3,694 views

1 answer to this question.

0 votes

If you write x.insert(2,3)
and then print x them it would show [1,2,3,3,4,5]

It will show nothing in your code as insert does not return anything

answered Oct 14, 2020 by Gitika
• 65,910 points

Related Questions In Python

+4 votes
3 answers

Write a for loop that prints all elements of a list and their position in the list. a = [4,7,3,2,5,9]

Try using this question by list comprehension: a=[4,7,3,2,5,9] print([x for ...READ MORE

answered Dec 9, 2019 in Python by vinaykumar
• 200 points
33,850 views
+3 votes
2 answers

how to print array integer without [] bracket in python like result = 1,2,3,4,5

Hey @abhijmr.143, you can print array integers ...READ MORE

answered Aug 5, 2018 in Python by Omkar
• 69,210 points

edited Aug 8, 2018 by Omkar 7,661 views
0 votes
1 answer

What is the output of and explanation?

It will print concatenated lists. Output would ...READ MORE

answered Jul 20, 2018 in Python by Priyaj
• 58,090 points
596 views
+1 vote
1 answer

What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

answered Aug 22, 2018 in Python by Priyaj
• 58,090 points
2,097 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,058 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,477 views
0 votes
1 answer

How to write a code In Python where input will be 1 then the output will be 2?

You can go through this:  def num(number): ...READ MORE

answered Oct 7, 2020 in Python by Gitika
• 65,910 points
923 views
0 votes
1 answer

what is the output of m = np.array([2,4,6]) n = np.array([2, True, False]) print(m+n)

Hi. @Nandini, The above code will give you ...READ MORE

answered Nov 11, 2020 in Python by Gitika
• 65,910 points
348 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP