Having trouble with the if-else statement

**I have a student who is having the following trouble:
When I was trying to create an else-if statement to meet the requirements that the artworks with an element id of 1 to 50 will display themselves to the user in the text_area1 output on detailsScreen when the artwork which the user selects from the dropdown on artHomeScreen is between the element id of 1 to 50. Likewise, I was also trying to create the if statement to meet the requirements that the artworks with an element id of 51 to 100 will display themselves to the user in the text_area1 output on detailsScreen when the artwork which the user selects from the dropdown on artHomeScreen is between the element id of 51 to 100. However, I was having the problem that the output kept on displaying the artworks with an element id of 51 to 100 in every attempt I tried to get the artworks with an element id of 1 to 50 to work, as well as the artworks with an element id of 51 to 100, but there was always a scenario where one of the strings did not work if the other one did.
**

**Here is the link to his original project: App Lab - Code.org (Here is the csv for the dataset if you need it:
Tate Museum Artworks.csv (996.8 KB)
(115 Bytes)

Any ideas on how to get the information he wants on the detailsScreen would be helpful.

Thank you for writing in. In accordance with the College Board’s guidelines for AP CS Principles Exam, we limit the debugging assistance we provide from March through the submission deadline for the Create Task.

From page 14 of the CB’s student handouts:

“you may not seek assistance in writing, revising, amending, or correcting your work, including debugging the program, writing or designing functionality in the program, testing the program, or making revisions to the program, from anyone other than your collaborative partner(s). "

Please verify this project is not part of a student’s Create Task for AP CS Principles.

If it is, we can only verify whether there is a technical issue with the platform causing the bug.
If it is not, we are happy to help locate the bug and provide guidance on fixing it!

Thank you,
Sangeeta

This is not for his Create Task.

On line 4 the student is using a table called Image. Could you share that as well?

Here is the file.

Image.csv (6.2 KB)

The student is not checking for the artId that is selected in the dropdown menu in the getInfo method. artId must be checked first and then the for loops should be done.

if (artId >= 0 && artId < 51) then
loop through the art titles and get the titles with art ids 0 through 50
else if (artId >= 51 && artId < 101) then
loop through the art titles and get the titles with art ids 51 through 100