Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

how to split a list containing string ans int into two sparate list

challange task 1

instances.py
def combiner(list):

1 Answer

You dont need to spit the list.

As question mentions that you just need to identify that a particular element is a string or not a string.

def combiner(arg):
    s=""
    n=0.0
    for elem in arg:
        if isinstance(elem, str):
            s = s+elem
        else:
            n = n+elem
    return s+str(n)

Do comment if it's not clear.