#πŸ”’ help with finding the bug

36 messages Β· Page 1 of 1 (latest)

burnt oak
#

So i have found two bugs from this code, but i cant figure out what the third one is

tawny relicBOT
#

@burnt oak

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

burnt oak
#

so the first bug i said was that lines 7 to 9 are not needed, since they remove half the ids and scores, which is not required in the question

#

the other bug was line 13. it indexes rows but it should index columns

#

whats the other bug?

#

the question says the three bugs r related to boolean masking, sorting logic and array indexing. so maybe something to do with sorting logic?

#

i cant find it tho

tardy cosmos
burnt oak
#

and it works

tardy cosmos
#

for example,

>>> import numpy as np
>>> a = np.arange(12).reshape(3, -1)
>>> a
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
>>> a[:, 1:3]
array([[ 1,  2],
       [ 5,  6],
       [ 9, 10]])
>>> a[1:3, :]
array([[ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
```then note the sorting part
burnt oak
#

but there doesnt seem to be a 2nd bug

tardy cosmos
burnt oak
#

i commented this out

#

and rewrote this so it indexes columns

#

and after printing i get

tardy cosmos
#

hm
looks fine to me too
maybe the original problem just considers one of your found bugs as 2?

burnt oak
#

the question states tho

the script contains three bugs related to boolean masking, sorting logic, and
incorrect array indexing

#

so it must be something related to sorting logic?

tardy cosmos
#

as to what constitutes a singular bug

burnt oak
#

so then what would the incorrect array indexing bug be then

tardy cosmos
#

or like up above at the mask area
"you shouldn't remove people through indexing" or smthn
again I think there's multiple ways you can cut it

burnt oak
#

ok yh cool

#

so esentially there could be 2 bugs in 1

tardy cosmos
burnt oak
#

thanks for ur help

burnt oak
burnt oak
#

!close

tawny relicBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.