Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Index List
#3
(Jul-09-2021, 10:52 PM)a04j Wrote: 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.
The instructions are unclear.
a) Is the original list ‘input’ by the user or passed as an argument to the function?
b) What is ‘string xy’ and where does it come from?
c) The example has one zero removed and an integer inserted in apparently the wrong place.
d) Should the function return both the new and original list?
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 5,983 Apr-27-2022, 05:46 PM
Last Post: deanhystad
  list index out of range OliverG 3 2,346 Sep-03-2021, 12:04 AM
Last Post: itsmycode
  List index out of range when turning CSV into dict ranbarr 15 6,474 May-12-2021, 10:38 AM
Last Post: ranbarr
  List vs index: Frederico_Caldas 5 3,614 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,274 Jun-20-2020, 06:53 PM
Last Post: Angry_bird89
  list index out of range mcgrim 2 2,917 May-25-2019, 07:44 PM
Last Post: mcgrim
  IndexError: list index out of range abdullahali 4 3,868 Jan-17-2019, 07:54 AM
Last Post: buran
  "List index out of range" for output values pegn305 3 5,312 Nov-26-2017, 02:20 PM
Last Post: heiner55
  list index out of range DrPengin 1 3,697 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