Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Flask Basics Welcome to Flask Multiply View

Cam S
Cam S
7,483 Points

the troubleshooting for this is incredibly useless. what does it want me to do?

i have tried so many different possibilities. the 'bummer' notification is amazingly ambiguous about what i need to correct.

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

these are the two responses i have given and altered a bunch, but to no success. any help would be appreciated. thanks.

flask_app.py
from flask import Flask

app = Flask(__name__)

@app.route('/multiply/<int:num1>/<int:num2>')
def multiply():
    return '5*5'

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,515 Points

Hey Cam S, the challenge is looking for a string containing the results from int math 5 * 5. Linke str(5 * 5)

Post back if you need more help. Good luck!!!

Cam S
Cam S
7,483 Points

i made it to the last question but can't seem to figure out what's wrong. tried placing str() and int() across several different areas (i was desperate, ha) but no luck. it's particularly puzzling because my answer is identical in format to 'The Adder' video, which preceded this challenge:

from flask import Flask

app = Flask(__name__)

@app.route('/multiply')
@app.route('/multiply/<int:arg1>/<int:arg2>')
@app.route('/multiply/<float:arg1>/<int:arg2>')
@app.route('/multiply/<int:arg1>/<float:arg2>')
@app.route('/multiply/<float:arg1>/<float:arg2>')

def multiply(arg1='5', arg2='5'):
    return '{} * {} = {}'.format(arg1, arg2, arg1 * arg2)

thanks for the reply, hope you find something missing that i'm too blind to see. cheers

Chris Freeman
Chris Freeman
Treehouse Moderator 67,515 Points

Almost there!

  • remove blank line between decorators and function
  • change default value for parameters to 5 instead of ’5’
  • change the format string to a single {} for the product only. No need to return the equation