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 trialMUZ140907 Wellington Maredza
3,014 PointsNow give hello() a default name argument of "Treehouse"
Ooops! it looks like Task 2 is nolonger passing.... WHY IS THAT SO
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name):
return 'Hello {}'.format(name)
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name="Treehouse"):
return 'Hello {}'.format(name)
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name="Treehouse"):
return 'Hello {}'.format(name)
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name="Treehouse"):
return 'Hello {}'.format("Treehouse")
1 Answer
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsHi Wellington
why did you repeat the code 4 times?. The task can be completed like so.
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name="Treehouse"):
return 'Hello {}'.format(name)
MUZ140907 Wellington Maredza
3,014 PointsMUZ140907 Wellington Maredza
3,014 Pointsthanks very much it did work out. i actually wasnt repeating the code but i was working it in full at every task level
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsAndreas cormack
Python Web Development Techdegree Graduate 33,011 PointsThat's ok long as you understand and it works.
Happy coding!!