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 trialm3shack
Python Development Techdegree Student 279 Pointsf-string error on line 5 but no line 3 or 8.
I am attempting to make my own if, elif, else statement.
Here is the code that I have written. https://github.com/M3SHack/_____SNDBX/commit/f262d4de8d9be2c1662365337c8ab01624e5cf3e
Here is the error that I am getting. https://prnt.sc/w3cr76
If I remove the f-string from line 5 the error goes away. Is there a reason why the f-strings on lines 3 and 8 do not throw errors?
PS any tips on how I could better ask this question and how I should include my research to help you all is welcomed.
Cheers.
m3shack
Python Development Techdegree Student 279 PointsMel,
I was able to change the repo to public. Additionally, I closed and reopened VSCode the error was still there.
who_are_you = input("What is your name? ")
if who_are_you == "Patty Wack":
print(f"Hiya {who_are_you} do you know Nick Nack?")
elif who_are_you == "I'm new":
"""@[Mel Rumsey](https://teamtreehouse.com/melrumsey) I tried using the .format instead of f"sometext"
and the error went away but did not print the expected response."""
print("Glad you decided to stop by {}.format(who_are_you) Please come in.")
else:
print("What is your name again?")
print(f"It's nice to meet you {who_are_you}.")
2 Answers
Mel Rumsey
Treehouse ModeratorOh I see the issue! I opened your github to look at your code and it looks like you are missing an underscore in your variable name on line 5 :)
print(f"Glad you decided to stop by {who_are you} Please come in.")
That should solve your issue!
m3shack
Python Development Techdegree Student 279 PointsWow. So this is what I have to look forward to in programming? :) I appreciate your help.
Mel Rumsey
Treehouse ModeratorLol, These issues happen all the time! Having another set of eyes on it always helps! Even the best programmers in the world experience typos regularly. :P
Keep on trekkin', coder 🖖
Mel Rumsey
Treehouse ModeratorMel Rumsey
Treehouse ModeratorHey m3shack! I tried to open up your github link to check out your code but I am getting a 404 error.
I copied your code down into my VSCode and everything seems to be running fine:
Getting this output: What is your name? Mel What is your name again? It's nice to meet you Mel.
Maybe try closing your vs code and reopening it. That has solved many of my issues. The code works on my end :) Hopefully that helps! If not, try to reshare your github link and I will check it out :)