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

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 68,457 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!!!

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 68,457 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