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 trialDavid Cheatham
10,431 PointsStuck on Instances
I feel like I must be missing something.
I run the code in a workspace and it spits out the correct result...
can someone look at it and tell me where I'm going wrong?
Thanks so much!
def combiner(*args):
string = ""
number = 0
for arg in args:
if isinstance(arg, str):
string += arg
else:
number += float(arg)
if number == 0:
number = ""
return string + str(number)
print(combiner("apple", 5.2, "dog", 8 ))
2 Answers
KRIS NIKOLAISEN
54,972 PointsThe challenge specifies that combiner takes a single argument so you don't need the splat operator.
def combiner(*args):
should just be
def combiner(args):
Also remove the print statement at the end.
David Cheatham
10,431 PointsThanks