Python Object-Oriented Python Inheritance Instances

David Cheatham
David Cheatham
7,840 Points

Stuck on Instances

I feel like I must be missing something.

I run the code in a workspace and it spits out the correct result...

can someone look at it and tell me where I'm going wrong?

Thanks so much!
def combiner(*args):
    string = ""
    number = 0
    for arg in args:
        if isinstance(arg, str):
            string += arg
            number += float(arg)

    if number == 0:
        number = ""
    return string + str(number)

print(combiner("apple", 5.2, "dog", 8 ))

2 Answers

Pro Student 51,854 Points

The challenge specifies that combiner takes a single argument so you don't need the splat operator.

def combiner(*args):

should just be

def combiner(args):

Also remove the print statement at the end.