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 trial

Python

I don't get this code challenge

Challenge Task 2 of 2

Excellent! Now I need you to add a new variable named total. Then assign total to the sum of current_count and upcoming_releases. I'd like you to use the variables, but if you just need to use the numbers, that's OK.

No where in the accompanying video does it show how to do what is being asked here and this is supposed to be a beginners course ???

I can name a variable

total = 16

Why are you asking for something you haven't shown us at this point? This has been done in some of the previous videos too

I don't want to have to google everything I don't get that should be included in the material before and not after the event

Mike

11 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Yes, the challenges are challenging (I take that name very seriously!) but they aren't covering things you haven't seen already. You've seen how to create variables. You've seen that you can add numbers together. You've seen that a variable can represent a number. You just have to put all of those pieces together.

Congrats on getting through the challenge! I'm sure you'll be slinging code in no time!

Well not exactly Kenneth

Where the confusion begins for me is

We are seeing you present it one way on the video (yes in that respect we have seen it already)

But then in the code challenges we are asked to present it in a way that we haven't seen you do in the videos to achieve the same result only in an arse about way that we haven't seen you present in the video. Then when we go back to the video to try and figure out how you did it we discover there is no consistency in the method of presentation that correlates to the challenges and I have to waste all this time coming to this forum to find the answers and try and figure it out which is really frustrating !!!!

So it will be a miracle if I make it to the end of this course because the course materials and videos are complete and done and challenges in place. So now I have to go through the same process of coming in here every time the code challenges don't work out for me because of inconsistent methodology . . .

The videos in my opinion are less for beginners and more for programmers or people with some kind of programming background who would be more likely to cope with these kinds of challenges and not be phased

Mike

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Perhaps "Then assign total to the sum of current_count and upcoming_releases" could be better worded as "Then assign the sum of current_count and upcoming_releases to total"

total = current_count + upcoming_releases

I took a screen shot is there no where to post it in here ?????

The message I am getting with exactly your code written the same way is

Oops! It looks like Task 1 is no longer passing ????

I have already answered Task 1 which said my answer was correct so I don't get the message ???

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

Unfortunately, screen shots cannot be posted directly. However, you can post them to imgur.com (or other free posting site), then add a link using

![alt text](/path/to/img.jpg "Title")

Wolf <null>
Wolf <null>
5,060 Points

Might as well try and ask here since I'm stuck on this one as well...

Error: " Bummer! invalid syntax (delete.py, line 2)"

My code:

current_count = 14
del planned = 5
upcoming_releases = 2
total = current_count + upcoming_releases

And I agree with Foroe Corp, that the challenges should be something from the videos and not something totally new. The Python courses are not the only one that has this problem, the java courses is another example.

[MOD: added ```python formatting -cf]

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Hey Wolf,

The error message says you have bad syntax on line 2. So, what's on line 2? What on there might be causing that bad syntax error? You can always copy and paste this code into Workspaces, too, to try and debug what might be going on. These are skills you'll find invaluable as a developer.

As for the challenges, they always reference back to material in the course and video. Are they one-to-one? No. Then you'd just be regurgitating what I said or did, not actually applying the techniques and knowledge yourself. We're not trying to teach you to only type what we type, we're trying to teach you to actually use the language.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

Sorry I accidentally hit 'best answer' link when trying for the 'comment' link. Unselected.

Wolf <null>
Wolf <null>
5,060 Points

Kenneth, I did post the code I used in workspace in my question. It is complaining on line 2.

Error: " Bummer! invalid syntax (delete.py, line 2)"

And if I remove that line, the first challenge step don't work.

Error: "Bummer! Don't delete any lines!"

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Right, there's a syntax error on line 2. Something you added made it a syntax error. So what did you change on line 2? What else could you change to make it not a syntax error?

Wolf <null>
Wolf <null>
5,060 Points

(edit* I have yet to figure out how to post code here so it is readable.. a moderator fix my code in the post before so it was readable)

First challenge is to delete planned variable (Use the del keyword).

current_count = 14 planned = 5 upcoming_releases = 2

answer that is passed is

current_count = 14 del planned = 5 upcoming_releases = 2

second part of the challenge "Now I need you to add a new variable named total. Then assign total to the sum of current_count and upcoming_releases."

current_count = 14 del planned = 5 upcoming_releases = 2 total = current_count + upcoming_releases

And with this one I get "Error: Bummer! invalid syntax (delete.py, line 2)" It is complaining on which passed first challenge -> del planned = 5

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Ah, I see a place where my validation isn't correct. Your del planned = 5 line shouldn't have passed because that's a syntax error (you can't delete and assign on the same line, it doesn't make sense). I've updated the challenge to have a better validation, a better error message for that step, and some refined instructions. Give it another shot!

Wolf <null>
Wolf <null>
5,060 Points

current_count = 14 planned = 5 del planned = 5 upcoming_releases = 2 total = current_count + upcoming_releases

Get invalid syntax still. "Bummer! invalid syntax (delete.py, line 3)"

Wolf <null>
Wolf <null>
5,060 Points

Awesome support work there Kenneth.

The challenge passed now. :D (finally)

Good luck with that one Wolf.

I asked about this question quite thoroughly days ago (actually 2 weeks or more now and received no real answer about it from Kenneth or Team Treehouse administrators as to whether the course was going to be restructured or corrected or some kind of mention as to what was happening with it and so far I have received 'Sweet Fanny Adams' which is how most of these courses are set up ? What else am I left to think ?

In my opinion there should be more feedback from the actual teachers or administrators when these questions are asked and at team treehouse you get nothing so I've given up on this course because it is badly put together and there is no support and I didn't want to go through the same frustration every step of the way

If it was my course and material I would be professional about it by responding when asked questions and redoing the videos so that the students actually learn something from them which should be the case here

But instead Team Treehouse continue to write new courses. They are good at pumping those out but not so good at improving the ones they already have which would be the smart thing to do if they want to grow their business

So in that respect I'm less than impressed but to be fair I did the Nick Petit course on HTML5 and really enjoyed it because it was well structured for beginners like me with very few mistakes

But Python is a 'Pigs Breakfast' of a course and Id suggest going else where if you want to learn something about it

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

You received help from both Chris and I about this question. I'm sorry you don't like the style of the code challenges, but there's no reason to be insulting.

Hi Kenneth

I sent you a lengthy answer to a comment you made to me about the code challenges student materials and videos from your perspective that I didn't agree with.

Then I attempted to explain to you from my perspective why that hadn't worked for me in an attempt to help improve the course for other students ?

You never responded to those comments and that was posted over 2 weeks ago then Wolf comes along who struggles with the same point in the course ? So what did you think I was going to say to him? I'm glad atleast his experience with you has been positive . . .

So sorry if you feel insulted Kenneth. maybe if you had responded to that comment 2 weeks ago the way you have speedily responded to Wolf with the exact same problem you wouldn't be feeling the way you do now

I never said at any point that I didn't appreciate your help or Chris Freemans Kenneth but it is common courtesy to respond when someone is making the effort to help improve things and communicate with you

Kind Regards

Mike

current_count = 14

del planned = 5

upcoming_releases = 2

total = current_count + upcoming_releases

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

You can't do del and assignment (=) on the same line.

current_count = 14

planned = 5

upcoming_releases = 2

del planned

total = current_count + upcoming_releases

Hi Chris,

I went back and answered the question for task 1 again which passed

and then when I typed your code in for task 2 it worked this time for some reason ?????

Go figure ?

So I have no idea what I did differently ?

Thank you for your help.

I may need it again

kind regards,

Mike

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

Excellent persistence! When coding through a web interface sometimes "gremlins" happen in the challenge grading. Retrying from the beginning is always worth a shot.

"'Help will always be given at Hogwarts Treehouse to those who ask for it."

Hi Chris,

Your method for adding an attachment is beyond my scope of experience as I am a beginner and do not know what that code means or where to even begin with it?

I can see I am going to struggle learning Python already but hopefully it will be worth the BLOOD SWEAT AND TEARS (mostly tears I'd say)

Mike

I tried that one myself early in the piece and it came back as a resounding wrong

thanks for your help anyway

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

What error are you seeing?

It just passed for me in the challenge.