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)
![larri krown](https://secure.gravatar.com/avatar/a21e5707bf1f5f48eedcc278307938a8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
larri krown
1,027 PointsFlask challenge:Didn't get the expected response.
What's wrong in my code? (Challenge is:Import request from Flask. Then update the index view to return "Hello {name}", replacing {name} with a name argument in the query string.)
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
def index(name="Larri"):
name = request.args.get('name', name)
return "Hello{}".format(name)
3 Answers
William Li
Courses Plus Student 26,868 PointsHi, larri krown Sooooo closed, only the return String format is off by couple of spaces.
return "Hello {} ".format(name)
![cassac](https://secure.gravatar.com/avatar/da089a69b306b3d923b8c01cb57f6aae?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
cassac
9,628 PointsWhat's the point of putting both 'name' and name in request.args.get()? I understand the purpose of the second name but the first one in quotation marks, what's the deal with that one?
![larri krown](https://secure.gravatar.com/avatar/a21e5707bf1f5f48eedcc278307938a8?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
larri krown
1,027 Pointsas i see this, one 'name' is the variable from flask/jinja template , second name is the value this variable, but i'm not shure
![cassac](https://secure.gravatar.com/avatar/da089a69b306b3d923b8c01cb57f6aae?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
cassac
9,628 PointsYeah, I'm not sure either. But, I believe this isn't the usual convention with Flask as introduced in the next video with variables directly in the URL.
![larri krown](https://secure.gravatar.com/avatar/a21e5707bf1f5f48eedcc278307938a8?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
larri krown
1,027 PointsI little confused you, it's exactly variables from the URL
To access parameters submitted in the URL (?key=value) you can use the args attribute:
searchword = request.args.get('key', '')
First 'name' is key from URL which return value, Second name get default value from function param named as name That's how i see it
larri krown
1,027 Pointslarri krown
1,027 PointsThank you buddy