loading
open in
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from flask import Flask
app = Flask(__name__)

def factors(num):
  return [x for x in range(1, num+1) if num%x==0]

@app.route('/')
def home():
  return "Open the URL and go to /factors/num to see the website"

@app.route('/factors/<int:num>')
def factors_route(num):
  return "The factors of {} are {}".format(num, factors(num))

if __name__ == '__main__':
  app.run(host='0.0.0.0')