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 trialKishore Kumar
5,451 Pointspython Basics
try: count = int(input("Give me a number: ")) except ValueError: count = 0
----------------------------: return count * 15
Please fill the correct answer
2 Answers
Joakim Skansen Flatmoen
Courses Plus Student 24,223 Pointstry: count = int(input("Give me a number: ")) except ValueError: count = 0 else: return count * 15
Michel Moreau L
21,751 PointsWhy does that make any sense? I mean...it is syntactically correct, but would it be useful to use that kind of combination for any problem to solve?
Joakim Skansen Flatmoen
Courses Plus Student 24,223 PointsException handling generally can be very useful.
When an exception occures in Python, it Causes the current process to stop and passes it to the calling process until it is handled. If not handled, our program will crash. For example, if function A calls function B wooden in turn calls function C and an exception occures in function C. If it is not handled in C, the exception passes to B and then A. If two never handled, an error message is spit out and our program come to a sudden, unexpected halt.
For a list of built-in exceptions please see the following url: https://docs.python.org/3.3/library/exceptions.html
I am unsure if this answered your question?
Vladan Grubesic
3,855 PointsThe answer here is "else".
try:
count = int(input("Give me a number: "))
except ValueError:
count = 0
else:
return count * 15
Nicholas Lim
Python Development Techdegree Student 6,055 PointsNicholas Lim
Python Development Techdegree Student 6,055 PointsI think this question needs to be more specific or something because I can program in python and I couldn't get what you wanted from this question. And the review video had nothing to do with the answer at all.