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 trialBartlomiej Szymański
4,182 PointsI forgot to use round brackets and got no error message
Hi there,
I was trying to run this code:
new_item = input("> ")
if new_item.upper == 'DONE' or new_item.upper() == 'QUIT':
break
elif new_item.upper == 'HELP':
show_help()
continue
elif new_item.upper == 'SHOW':
show_list()
continue
else:
add_to_list(new_item)
I didn't use round brackets after upper method and I spotted that:
1) There was no error message.
2) I couldn't use 'HELP'/'SHOW'/'DONE', this was added as a additional item.
Can someone explain me why?
Regards, Bartek
1 Answer
KRIS NIKOLAISEN
54,972 PointsIf you print new_item.upper you'll see something like this:
<built-in method upper of str object at 0x7f769b112a08>
which obviously doesn't = 'HELP', 'SHOW' or 'DONE'
The upper method will only be called with the parentheses