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 trialSean Frye
1,167 PointsOh no!
Well now I don't even know if I should even bother learning Python. All I do is get stuck. This is incredibly frustrating! These are just the basics and I can't proceed! I am really trying here! I just wish I knew what I was supposed to do. It felt great to finally get some challenges done in 1 try, no help needed, but I've been stuck here! All I do is get confused. I'm starting to wonder if I should just give up on learning to code or if I could learn a different form of coding a lot easier than Python. It's so strict and it's so frustrating!
try:
def add(x, y):
except ValueError:
a = float(x)
b = float(y)
else:
return(a+b)
2 Answers
Steven Parker
231,269 PointsYou're close, but things are a bit out of order:
- when defining a function, the "def" line must be the very first thing
- anything inside the function must be indented more than the "def" line
- the "float" conversions must be done as part of the "try"
- then the "except" still needs to "return None"
Also, you might enjoy this episode of the Treehouse Show, which covers learning challenges and strategies, including a few suggestions by me!
behar
10,799 PointsHey Sean! Please write back here if your still having trouble.
That being said, i promise EVERYONE fells the frustration that your feeling right now. I can totally relate, coding is very difficult in the beginning. But that makes sense right? Your learning something completely new, a ton of new concepts that youve never heard about are being introduced, not only do you have to memorise the syntax, but you also have to get the concepts down. This takes time, and you really wouldent expect it to be easy?
I promise you tho, if you stick with it, it will get better, and in no time you'll be building your own software applications. Stick with it!