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 trialbright chibuike
3,245 Pointsinstances objective 1
what could be the answer to this question . here is my code i have written:
def combiner(data): data =["apple",5.2,"dog",8] data1 = data[::2] data2 =data[1::2] if isinstance(data1,(str)) ==True and isinstance(data2,(int,float)) ==True: return sum(data1,data2)
def combiner(data):
data =["apple",5.2,"dog",8]
data1 = data[::2]
data2 =data[1::2]
if isinstance(data1,(str)) ==True and isinstance(data2,(int,float)) ==True:
return sum(data1,data2)
1 Answer
Steven Parker
231,271 PointsHere's a few hints:
- don't overwrite the data with a literal, use the "data" as provided by the caller
- don't make any assumptions about the contents or order that the provided data will have
- you can expect the actual test data will not be the same as the example that was shown
- you will probably need a loop and probably not need slices