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 Letter Game Introduction

start.lower? upper works as well

Hi I'm just curious as to why we put start.lower() == 'q': break I tried doing start.upper() == 'Q': break
and it works as well. I was just wondering why start() == 'q', without a .upper or.lower doesn't work.

thanks!

3 Answers

andren
andren
28,558 Points

start() will produce an error due to the fact that start is not a method. The parenthesis tells Python that you want to call a method, which is fine for lower and upper since they are methods, but not for start itself as that is just a string variable.

This issue can be resolved by simply removing the parentheses so the comparison is simply start == 'q', though at that point you will run into the issue that james south mentioned. If a user enters a capital Q the loop won't break since q and Q are technically different letters as far as Python is concerned.

Thanks for the replies! makes sense, I will review all that.