1

Maybe I'm getting something basic confused but I cant seem to work out how to fix this issue.

enter image description here

The compiler gives me

Traceback (most recent call last): File "python", line 153, in <module> File "python", line 90, in finish File "python", line 25, in registered AttributeError: 'Marathon' object has no attribute 'runnerList'

Which all seem to be the same issue. Surely the instance does have members. I'm not sure why it thinks it doesn't.

class Marathon:

# Creator
# -------

runnersList = []
timesList = []

def __init__(self):
  """Set up this marathon without any runners."""

# Inspectors
# ----------

# These are called anytime.

def registered(self, runner):
  """Return True if runner has registered, otherwise False."""
  for item in self.runnerList:
    if item == runner:
      return True
  else:
    return False
user23432432
  • 125
  • 2
  • 8
  • 1
    `runnerList` is not `runnersList`. – user2357112 Apr 03 '18 at 04:08
  • Also you're declaring class attributes instead of instance attributes. [You should fix that.](https://stackoverflow.com/questions/1680528/how-to-avoid-having-class-data-shared-among-instances) – user2357112 Apr 03 '18 at 04:09

0 Answers0