Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Brian Minkin
Courses Plus Student 795 Pointschecked independently, but not working here
I am getting errors on this. Don't know why. Compiles independently
# combo([1, 2, 3], 'abc')
# Output:
# [(1, 'a'), (2, 'b'), (3, 'c')]
my_tuple = []
a = [1,2,3]
b = ('abc')
def combo(*args):
for i in range(len(a)):
c= (a[i], b[i])
my_tuple.append(c)
return my_tuple
combo(a,b)
6 Answers

Steven Parker
220,513 PointsThe challenge tests your work using arguments that are not the same as the examples!
So when constructing the solution:
- don't use any fixed values, work only with the supplied arguments
- all code should be part of (inside) the function
- you only need to define the function, not call it

Brian Minkin
Courses Plus Student 795 PointsOk, I just set everything within the function. But still not working.
def combo():
a = [1,2,3]
b = ('abc')
my_tuple = []
for i in range(len(a)):
c = (a[i], b[i])
my_tuple.append(c)
return my_tuple
</p>```
"don't use any fixed values, work only with the supplied arguments"
what are the supplied arguments then? This specificities of how the compiler operates and what exactly is expected is really horribly explained.

Steven Parker
220,513 PointsThe supplied arguments are the ones you were calling "*args
" in your original definition. You can bet that when the challenge tests your function, the arguments it will give it will not be [1, 2, 3]
and 'abc'
.
The instructions say the function "takes two ordered iterables". Perhaps you would call them "a" and "b"?

Brian Minkin
Courses Plus Student 795 Pointsso changed to
def combo(a,b):
only error is "bummer: try again." No specifics. This is really unnecessarily mystifying.

Steven Parker
220,513 PointsWhen you added the parameters, did you also remove the assignments of the fixed values?
Also, does that stray HTML tag actually appear on the bottom line?

Brian Minkin
Courses Plus Student 795 Pointsdef combo(a,b): my_tuple = [] for i in range(len(a)): c = (a[i], b[i]) my_tuple.append(c) return my_tuple
This is the state of it now. The html tag was me being clever and trying to follow the markdown cheatsheet guidelines. Really, shouldn't *args be sufficient as the argument?

Steven Parker
220,513 PointsSo does it pass now?
And your formatting was good other than that HTML tag. Perhaps you were just looking at an example where the formatting was applied to some HTML? Do use the formatting, Python is impossible to check without it.
And yes, you could code it using *args but it's simpler to just have two parameters.

Brian Minkin
Courses Plus Student 795 PointsI work in anaconda, with spider. Formatting is good. the tag was done when positing to you here. This is still not working! error given is "Bummer, try again" Honestly, what kind of error is that? It speaks nothing to the problem. This is really becoming asinine.

Steven Parker
220,513 PointsCan you show the code (with formatting) that you have now?

Brian Minkin
Courses Plus Student 795 Pointsdef combo(a,b):
my_tuple = []
for i in range(len(a)):
c = (a[i], b[i])
my_tuple.append(c)
return my_tuple
</p>

Brian Minkin
Courses Plus Student 795 Pointsok, I have no idea how to get rid of last tag. Anyhow you can see the bit of code.

Steven Parker
220,513 PointsI don't see anything wrong except for that stray HTML paragraph tag.
So I pasted the rest of it directly into the challenge and it passed.

Brian Minkin
Courses Plus Student 795 Pointsok thanks, but obviously there is a bug in the system. Is there somebody who can update my profile then?

Steven Parker
220,513 PointsI don't understand how your profile would be involved, but for system issues you should contact the Support folks.