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

Python Flask Basics Welcome to Flask Multiply View

Ker Zhang
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ker Zhang
Full Stack JavaScript Techdegree Graduate 29,113 Points

Pls 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.

flask_app.py
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')
Lihua Yao
Lihua Yao
4,218 Points

I have same code with yours, but still doesn't work. Did you finally find the solution?

1 Answer

Hi 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"