Python Object-Oriented Python Inheritance Instances

Function Works, Doesn't Pass Challenge Task

This works in a test Workspace I have. I printed the called function and passed ("dog, 17, "cat", 8.2) as arguments, and receive the output of "dogcat25.2".

The error of 'Bummer: Didn't get the expected output' when I check the work for the challenge doesn't really give me much to go on.

Something I'm missing? Is there a way for me to see what arguments are being passed when checking this Challenge so I can more effectively debug?

instances.py
def combiner(*args):
    strings = ""
    numbers = 0.0

    for item in args:
        if isinstance(item, str):
            strings +=item
        elif isinstance(item, (int, float)):
            numbers += float(item)
    return strings + str(numbers)

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
53,441 Points

The challenge tells you a single list will be passed as an argument and gives you an example. If you want to test try:

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

and the result should be:

appledog13.2

Your code returns

0.0

So it does. I missed that. Thanks!