Python Object-Oriented Python Inheritance Instances

Malcolm Aldrin Masumba
Malcolm Aldrin Masumba
3,626 Points

Am stuck

Am not sure what a supposed to do

instances.py
def combiner(list):
    list = ["apple", 5.2, "dog", 8]
    total = 0

for combine in combiner:
    if (isinstance(combiner, str)):
        ret_val += combiner
    else:
        total += combiner
    return ret_val + str(total)

1 Answer

Maciej Deliś
Maciej Deliś
4,890 Points
def combiner(list):

    total = 0
    ret_val = ""
    for i in list:
        if (isinstance(i, str)):
            ret_val += i
        else:
            total += i
    return "{}{}".format(ret_val, total)

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