Python Forum
General list size question to solve problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
General list size question to solve problem
#2
xx[horse_count] is not a list but a numpy array. It's telling you the numpy array has size 98. That means since the array is zero-indexed, the largest index you can request is 97. Asking for xx[horse_count][98] is too big.

>>> arr = np.ones(98)
>>> arr[97]
1.0
>>> arr[98]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: index 98 is out of bounds for axis 0 with size 98
Reply


Messages In This Thread
RE: General list size question to solve problem - by bowlofred - Sep-27-2020, 06:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can someone help me solve this programming problem? SuchUmami 6 979 Nov-20-2023, 10:01 AM
Last Post: EdwardMatthew
  A simple problem, how best to solve it? SuchUmami 2 754 Sep-01-2023, 05:36 AM
Last Post: Pedroski55
  python can - general question caslor 0 1,142 Jul-14-2022, 05:21 PM
Last Post: caslor
  How to solve this simple problem? Check if cvs first element is the same in each row? thesquid 2 1,279 Jun-14-2022, 08:35 PM
Last Post: thesquid
  How do I solve the second problem? Cranberry 1 1,157 May-16-2022, 11:56 AM
Last Post: Larz60+
  Problem with "Number List" problem on HackerRank Pnerd 5 2,165 Apr-12-2022, 12:25 AM
Last Post: Pnerd
  a general question barryjo 5 1,561 Feb-01-2022, 10:12 PM
Last Post: Gribouillis
  Try to solve GTG multiplication table problem. Frankduc 6 2,075 Jan-18-2022, 08:26 PM
Last Post: Frankduc
  General Programming Question with Dictionary giddyhead 12 2,827 Jan-10-2022, 10:12 AM
Last Post: Pedroski55
Big Grin General programming question (input string)[ jamie_01 2 1,643 Jan-08-2022, 12:59 AM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

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