Python Forum
Accessing data in zip - Index out of range
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing data in zip - Index out of range
#15
This may look like a repeated question, but oh my gosh, its confusing for me, that is why i am posting in homework although it is not homework. i have 3 lists
Names=["Jack","Jeni","Monsa","Mehus","Kuis","Tim","Tony","Yestgf","Pere"]
Years=[17,20,26,40,67,88,96,99,37]
Order=[1,2,3,4,5,6,7,8,9]
i want them to be manipulated to get the following things

i have a number and i want that number to be divided by length of order and the result will be the first range of n ranges and i want them to be further divided by the sum of years to get each share and then multiply that share according to the years, on top of all these i want the names to be printed using enumerate which i got as follows
Names=["Jack","Jeni","Monsa","Mehus","Kuis","Tim","Tony","Yestgf","Pere"]
Years=[17,20,26,40,67,88,96,99,37]
Order=[1,2,3,4,5,6,7,8,9]
for idx,name in enumerate(Names):
    for idx in range(idx,idx+len(Names)):
        for idy in range(idx,idx+len(Names)):
            for idz in range(idy,idy+len(Names)):
                for ida in range(idz, idz + len(Names)):
                    print(name,Names[idx%len(Names)],Names[idy%len(Names)],Names[idz%len(Names)],Names[ida%len(Names)])
Reply


Messages In This Thread
How can we connect multiple lists and manipulate many things - by pythoneer - Mar-11-2018, 05:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to fix list index out of range longmen 26 6,067 Apr-27-2022, 05:46 PM
Last Post: deanhystad
  list index out of range OliverG 3 2,353 Sep-03-2021, 12:04 AM
Last Post: itsmycode
  List index out of range when turning CSV into dict ranbarr 15 6,493 May-12-2021, 10:38 AM
Last Post: ranbarr
  list index out of range mcgrim 2 2,922 May-25-2019, 07:44 PM
Last Post: mcgrim
  IndexError: list index out of range abdullahali 4 3,879 Jan-17-2019, 07:54 AM
Last Post: buran
  String index out of range felie04 2 5,550 Aug-17-2018, 11:18 PM
Last Post: felie04
  "List index out of range" for output values pegn305 3 5,318 Nov-26-2017, 02:20 PM
Last Post: heiner55
  list index out of range DrPengin 1 3,702 Nov-09-2017, 08:35 PM
Last Post: gruntfutuk
  string index out of range cusick11 9 15,153 Mar-03-2017, 11:45 PM
Last Post: ichabod801
  Invalid syntax: string index out of range darkreaper1959 6 6,184 Jan-22-2017, 06:24 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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