Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Index List
#1
Write a function that returns a new list from the input list with a string xy inserted before the first 0, but only if this 0 is followed by other zeros.
Eg: [3,5,0,0,0,2,5,4,7] then insert string between 5 and 0 [3,5,0,0,2,5,4,6,7] then return the original list.

Can someone please help me with this exercise? Sad
Reply


Messages In This Thread
Index List - by a04j - Jul-09-2021, 10:52 PM
RE: Index List - by Larz60+ - Jul-09-2021, 11:06 PM
RE: Index List - by BashBedlam - Jul-10-2021, 01:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to fix list index out of range longmen 26 6,278 Apr-27-2022, 05:46 PM
Last Post: deanhystad
  list index out of range OliverG 3 2,405 Sep-03-2021, 12:04 AM
Last Post: itsmycode
  List index out of range when turning CSV into dict ranbarr 15 6,646 May-12-2021, 10:38 AM
Last Post: ranbarr
  List vs index: Frederico_Caldas 5 3,690 Jul-03-2020, 10:55 AM
Last Post: DeaD_EyE
  To find the index of the first occurrence of the key in the provided list Angry_bird89 4 3,338 Jun-20-2020, 06:53 PM
Last Post: Angry_bird89
  list index out of range mcgrim 2 2,967 May-25-2019, 07:44 PM
Last Post: mcgrim
  IndexError: list index out of range abdullahali 4 3,960 Jan-17-2019, 07:54 AM
Last Post: buran
  "List index out of range" for output values pegn305 3 5,375 Nov-26-2017, 02:20 PM
Last Post: heiner55
  list index out of range DrPengin 1 3,739 Nov-09-2017, 08:35 PM
Last Post: gruntfutuk

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020