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

Markus Henze
Markus Henze
1,798 Points

Why isn't this working?

?

flask_app.py
from flask import Flask

app = Flask(__name__)

@app.route("/")
@app.route("/multiply/<int:num1>/<int:num2>")
def multiply(num1=5,num2=5):
    return "{} * {} = {}".format(str(num1),str(num2),str(num1*num2))

1 Answer

Ryan S
Ryan S
27,276 Points

Hi Markus,

I am assuming you are on task 2.

There are a few things to note about this challenge.

First, you are asked to add a new route to the view, not replace it. So the original "/multiply" should still be there. In the later tasks you will be asked to add more.

Second, none of the tasks ask you to return a string in the format that you have provided. You should leave the returned product as you had it for task 1 until you are specifically asked to change it.

And third, although it shouldn't affect the outcome, you are not asked to add a "/" route.

The thing with these challenges is that if you add, remove, or change anything that was not asked for there is a high probability that it won't pass, even if it is valid code.

Hope this helps.