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 trialIsabella Elyse Letson Ettin
784 PointsOnly else statement is printing, even when I use different names.
Hi! Even though I believe I have indented properly and have compared my code to Craig's, I'm still only getting my "else" statement. This happens even when I input first_name objects that should print other statements. What might be wrong?
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsHey Isabella Elyse Letson Ettin, a clue can be found in your output text.
The text shows βYou should totally learn Python, Creighton !
β, but the code has:
"You should totally learn Python, {}!"
Notice there isnβt any space between the format placeholder and the exclamation point but a space is being printed in the output.
Perhaps you are entering an extra space during typing responses?
One workaround would be to replace the absolute match with a first_name.startswith()
statement.
Post back if you need more help. Good luck!!!
Isabella Elyse Letson Ettin
784 PointsHi Chris,
Thank you for your help! This turned out the be the problem!
Isabella Elyse Letson Ettin
784 PointsIsabella Elyse Letson Ettin
784 PointsWhoopsie didn't know how to attach my code! Here it is:
Then, I am getting back this: