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 trialKer Zhang
Full Stack JavaScript Techdegree Graduate 29,113 PointsPls help: Flask multiplication challenge step 5
I've completed the code step by step but stopped at step 5. The course just keep telling me 'It looks like Task 1 is no longer parsing....'
Actually I've run all these code in my PyCharm everything was fine. Don't know why the course checker can't pass it.
BTW, I just feel the task 5 description is not clear enough, I don't understand whether it requires only the multiplication result or also needs the formula.
from flask import Flask
app = Flask(__name__)
@app.route('/multiply/<int:num1>/<int:num2>')
@app.route('/multiply/<float:num1>/<int:num2>')
@app.route('/multiply/<float:num1>/<float:num2>')
@app.route('/multiply/<int:num1>/<float:num2>')
def multiply(num1, num2):
return '{} * {} = {}'.format(num1, num2, num1*num2)
#app.run(debug=True, port=8000, host='0.0.0.0')
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Ker Zhang,
Task 1 had you add a '/multiply' route that took no arguments. You seem to be missing that now and you only have all the int/float combinations.
Also, in task 2 when you add the arguments to the view, they should have default values of 5.
def multiply(num1=5, num2=5):
And for the return value, it should be the result of the multiplication only as a string. If the arguments were 5 and 10 for example then it should return "50"
Lihua Yao
4,218 PointsLihua Yao
4,218 PointsI have same code with yours, but still doesn't work. Did you finally find the solution?