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 Python Basics (2015) Letter Game App Review: Python Basics

Kishore Kumar
Kishore Kumar
5,451 Points

python Basics

try: count = int(input("Give me a number: ")) except ValueError: count = 0

----------------------------: return count * 15

Please fill the correct answer

I 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.

2 Answers

Joakim Skansen Flatmoen
PLUS
Joakim Skansen Flatmoen
Courses Plus Student 24,223 Points

try: count = int(input("Give me a number: ")) except ValueError: count = 0 else: return count * 15

Michel Moreau L
Michel Moreau L
21,751 Points

Why 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
Joakim Skansen Flatmoen
Courses Plus Student 24,223 Points

Exception 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
Vladan Grubesic
3,855 Points

The answer here is "else".

try: 
    count = int(input("Give me a number: ")) 
except ValueError: 
    count = 0
else: 
    return count * 15