Skip to main content

Posts

Showing posts with the label Lists Hackerrank Solution Python

Lists Hackerrank Solution Python

 Lists Hackerrank Solution Python For Explanation Watch Video: Sample Input 0 12 insert 0 5 insert 1 10 insert 0 6 print remove 6 append 9 append 1 sort print pop reverse print Sample Output 0 [6, 5, 10] [1, 5, 9, 10] [9, 5, 1] Code: if  __name__ ==  '__main__' :     N =  int ( input ())     L = []      for  i  in   range (N):         cmd =  input ().split()          if  cmd[ 0 ]== 'insert' :             L.insert( int (cmd[ 1 ]), int (cmd[ 2 ]))          elif  cmd[ 0 ]== 'print' :              print (L)          elif  cmd[ 0 ]== 'remove' :    ...