I have a student who is trying to sort out NFL teams by region using a drop down menu. I am utterly stumped and feel that it is just so simple that it is escaping me, or it is so complex that it is well above me. We have tried to model off the museum ticket app, and other projects but HELP! He would like to have a program where if you choose East only the teams in the east will be sorted out, and then one will be randomly displayed as the team to check out.
What I expect to happen: He would like the teams to be randomly chosen by region. He reworked the data set so the teams are in region order and that is how he developed the random number choices. However with the code set the way it is he gets a ustring error.
What actually happens: If we rework the indexVariable he created to have an original value, the program does run successfully and will show us the team name and logo, however it will only show the buffalo bills…or whatever team is set in the table at the same value he assigns the variable.
What I’ve tried: We have tried the stacked if statements, as well as if else statements and that does not work. We also have tried to relocate all of the statements to another point in the code. As before we have also tried to adjust the indexVariables value when naming and that is a flop too. We just cannot figure out how with the dropdown menu to get the randomized number from a certain column within the data set, and to attain that random number to be used to produce the correct image and name.