Python Object-Oriented Python Inheritance Instances

kalyada leosrisook
PRO
kalyada leosrisook
Pro Student 15,112 Points

Why is this not correct, when I got the right answer on my local IDE

I am not sure what I'm doing wrong. I did this on my IDE and I got the correct answer but for some reason it doesn't seem to work here .

instances.py
    def combiner(items):
        numCount = 0
        word = ""
        for item in items:
            if(isinstance(item,(int,float)) ):
                numCount += item
            elif(isinstance(item, str)) :
                word.append(item)
        return "{}{}".format(word,numCount)

1 Answer

William Li
William Li
6,045 Points

I don't think string objects have an "append" method. Instead of

word.append(item) 

use

word += item