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 trialyoussef b10ta
Courses Plus Student 2,755 PointsDidn't get the expected output?? maybe you didnt expected the way i did slove it ....
def combiner(strings):
string = ' '
number = 0
for i in strings:
if isinstance(i,(int,float)):
number += i
else:
string += i
return f"{string}{number}"
1 Answer
KRIS NIKOLAISEN
54,972 PointsYou initialized string
with a space so there will be a leading space in your result.
Use:
string = ''
instead of:
string = ' '
youssef b10ta
Courses Plus Student 2,755 Pointsyoussef b10ta
Courses Plus Student 2,755 PointsOh i didnt see that :) Thanks KRIS NIKOLAISEN