loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8346715624269105","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZnJvbSBmbGFzayBpbXBvcnQgRmxhc2sKYXBwID0gRmxhc2soX19uYW1lX18pCgpkZWYgZmFjdG9ycyhudW0pOgogIHJldHVybiBbeCBmb3IgeCBpbiByYW5nZSgxLCBudW0rMSkgaWYgbnVtJXg9PTBdCgpAYXBwLnJvdXRlKCcvJykKZGVmIGhvbWUoKToKICByZXR1cm4gJzxhIGhyZWY9Ii9mYWN0b3JzX3Jhdy8xMDAiPiBjbGljayBoZXJlIGZvciBhbiBleGFtcGxlPC9hPicKCkBhcHAucm91dGUoJy9mYWN0b3JzX3Jhdy88aW50Om4+JykKZGVmIGZhY3RvcnNfZGlzcGxheV9yYXdfaHRtbChuKToKCWZhY3RvcnNfbGlzdCA9IGZhY3RvcnMoaW50KG4pKQoJIyBGaXJzdCB3ZSBwdXQgdGhlIHN0dWZmIGF0IHRoZSB0b3AsIGFkZGluZyAibiIgaW4gdGhlcmUKCWh0bWwgPSAiPGgxPiBUaGUgZmFjdG9ycyBvZiAiK3N0cihuKSsiIGFyZTwvaDE+IisiXG4iKyI8dWw+IgoJCgkjIGZvciBlYWNoIGZhY3Rvciwgd2UgbWFrZSBhIDxsaT4gaXRlbSBmb3IgaXQKCWZvciBmIGluIGZhY3RvcnNfbGlzdDoKCQlodG1sICs9ICI8bGk+IitzdHIoZikrIjwvbGk+IisiXG4iCglodG1sICs9ICI8L3VsPiA8L2JvZHk+IiAjIHRoZSBjbG9zZSB0YWdzIGF0IHRoZSBib3R0b20KCXJldHVybiBodG1sCgppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgogICAgYXBwLnJ1bihob3N0PScwLjAuMC4wJykKCg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 '<a href="/factors_raw/100"> click here for an example</a>'

@app.route('/factors_raw/<int:n>')
def factors_display_raw_html(n):
	factors_list = factors(int(n))
	# First we put the stuff at the top, adding "n" in there
	html = "<h1> The factors of "+str(n)+" are</h1>"+"\n"+"<ul>"
	
	# for each factor, we make a <li> item for it
	for f in factors_list:
		html += "<li>"+str(f)+"</li>"+"\n"
	html += "</ul> </body>" # the close tags at the bottom
	return html

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