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 trialYu-Che Hung
Courses Plus Student 10,607 PointsHow to solve this challenge?
How to solve this challenge?
1 Answer
Krishna Pratap Chouhan
15,203 PointsPlease do read the comment
def combiner(argList):
result = ""
#finding sum of all the numbers and appending all the string
Nsum=0.0
Ssum=""
for i in argList:
#if i is int or float add into sum of numbers otherwise it must be a string.
#isinstance(a, classname) function checks if <a> is an object of class <classname>
#Remember, the number could be an int or a float.
if isinstance(i, int) or isinstance(i, float):
Nsum = Nsum + i
else:
Ssum += i
#Appending string_collection and sum_of_numbers together into a string.
result = Ssum + str(Nsum)
return result