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!
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

Huijuan Pei
1,537 PointsWhy does it appear as syntax error ?
Why does it appear as syntax error when I try to run the following code?
try: a=int(input("Give me a number: ") except ValueError: print("This is not a number!") else: print('Hi'*a)
2 Answers

Dylan Rainwater
15,537 PointsHi Huijuan,
It appears that you are missing a second closing parenthesis around your input. It should be:
try:
a = int(input("Give me a number: "))
except ValueError:
print("This is not a number!")
else:
print('Hi'*a)

Huijuan Pei
1,537 PointsThanks Dylan. I looked at it for 30 minutes, couldn't spot the missing parenthesis. Guess I need a pair of glass for better coding :)

Dylan Rainwater
15,537 PointsNo problem! It's always easy to miss a parenthesis here or there.