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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Leslio McKeown](https://uploads.teamtreehouse.com/production/profile-photos/10468622/micro_wp4660129.jpg)
Leslio McKeown
Python Development Techdegree Student 9,439 Pointstechnical interview prep: Python basic
i can't seem to find out why it keeps saying incorrect
city = ("Kansas ")
teamname = ("City Royals. ")
def cheer(city, teamname):
return ("Let's go, ", city, teamname, "Let's go!")
1 Answer
![Asher Orr](https://uploads.teamtreehouse.com/production/profile-photos/11686423/micro_updated_headshot_2022.jpg)
Asher Orr
Python Development Techdegree Graduate 9,408 PointsHi Leslio! When I ran your code in the challenge, I saw this error message:
AssertionError: ("Let's go, ", 'Kansas City', 'Royals', "Let's go!") != "Let's go, Kansas City Royals. Let's go!" :
Uh oh, I didn't get the correct string returned. It should have been 'Let's go, Kansas City Royals. Let's go!'
The program is looking for this exact string:
"Let's go, Kansas City Royals. Let's go!"
Whereas your code is returning this:
"Let's go, ", 'Kansas', 'City Royals', "Let's go!"
I would wrap your entire return statement in one quotation mark, and I would use {curly brackets} to format the city and team name in your statement. Like this:
def invitation(day, address):
return("I'm having a party on {} this week. You should come! My address is {}.".format(day, address))
That way, your arguments won't have quotation marks around them when your function is returned (and you'll have an exact match.)
PS- you don't have to define the city and teamname before you write out the function. When you click "Check Work" on the challenge, the Treehouse Program calls your function and passes in arguments (you just don't see it.)
It does this:
def invitation(day, address):
print("I'm having a party on {} this week. You should come! My address is {}.".format(day, address))
invitation("Tuesday", "123 Main Street")
#^ It calls your function and passes in the arguments. It uses "Kansas City" for the city and "Royals" for the teamname. That's why you see that team specifically in the error message.
Leslio McKeown
Python Development Techdegree Student 9,439 PointsLeslio McKeown
Python Development Techdegree Student 9,439 Pointsoh, I understand now, thank you so much!!! I almost feel ashamed that I forgot something as easy as .format or f string
Asher Orr
Python Development Techdegree Graduate 9,408 PointsAsher Orr
Python Development Techdegree Graduate 9,408 PointsYou're welcome! I'm glad you're all set. No worries about forgetting, either! It happens to everyone (even the senior devs experience it.)
Also, don't forget to mark "best answer" on my response. That way others will know that you've been helped, and they won't waste time by clicking on the question.