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 trialfady mohamed
5,972 PointsDifferent Methods to Complete Challenges.
With all these different methods to complete the challenges, is it possible to have a list of solutions somewhere? I'm sure a lot of times I may have completed a challenge in a very inefficient way, would be good to see the instructor's method upon completion.
For instance in the num_courses challenge I used the below code to return the number of courses:
def num_courses(dict):
courses = []
for values in dict.values():
courses.extend(values)
return len(courses)
then the next step was "increasing the difficulty" by asking to return a list of all the courses. which I did by just removing the len() method from my previous code which got me thinking my previous solution was not the best one:
def courses(dict):
courses = []
for values in dict.values():
courses.extend(values)
return courses
fady mohamed
5,972 PointsHi Viraj, I understand that however I also see it having a drawback, such as completing challenges thinking you're on the right track when really you might be doing it all in an inefficient and unconventional way. The only way to avoid that is by asking whether you're doing it right every time. and yea a solutions-area isnt a good idea, but maybe at least display the instructor's solution once you have completed the challenge?
1 Answer
Viraj Deshaval
4,874 PointsHi Fady, It's the personal view of yours and I totally appreciate it. But the one you are calling inefficient and unconventional way of completing code challenges is I call it a second way of solving the problem,because when you code something there will be a lot of different ways you can solve the problem. In treehouse we also have hint section and that shows some hint if we do something wrong.
Just think if we introduce answer section after completing code challenge then you may not be boosted when you solve challenge instead you will think of you need to code like this but we should not force coders to code in my way. So I believe learning new things using community and doing some research is the best way.
Viraj Deshaval
4,874 PointsViraj Deshaval
4,874 PointsThere is a reason behind this. Why we do not have answers area at Treehouse i.e. every treehousers should try and learn new stuff on their own and in doubt ask community. In this way, those who answer can refresh his knowledge and those who ask questions can get some insights.