Somehow, I don’t think I am not doing this right. My thought process seems to be wrong.
Error TypeError: unbound method scan() must be called with Lexicon instance as first argument (got str instance instead)
This happens when I have tried importing. There for I can’t do test this way. I think I remember something about this when reading.
ex48.ex48_convert.py import Lexicon as lexicon
Code for ex48_convert.py
""" take in string value seperated by a space that describes a compass direction and then adds these to a list where each compass point is proceeded by the word "direction" eg [('direction', 'north')] """ def __init__(self): self.sentence =  def scan(self, value): self.sentence = value.split() self.compass_direction() def compass_direction(self): for x in range(len(self.sentence)): if (self.sentence[x] == 'north' or self.sentence[x] == 'south' or self.sentence[x] == 'east' or self.sentence[x] == 'west'): self.sentence[x] = ('direction', self.sentence[x]) [/code]
How did other people do this exercise?