I’m doing a coding exercise and it want’s me to use negative indicates to access a variable called ellies_score. I did this and it is telling me I’m not using negative indicates. Here is the code:
class_name_test = [['Jenny', 90], ['Alexus', 85.5], ['Sam', 83], ['Ellie', 101.5], ['Bob', 87.6]]
ellies_score = class_name_test[-2] [-1]
print(ellies_score)
Since a grader can't tell what indices you used by looking solely at the output, it must be analyzing the code itself. Unfortunately, auto-graders are often simplistic and unforgiving of things like extra spacing that they didn't account for.
class_name_test[-2] [-1]
This has a superfluous, uncommon space between the [-2]
and [-1]
, which may be throwing off the checker. I would remove that space to appease the checker, and because I don't believe that helps readability or is encouraged by any style guide I've ever seen.