amazing
Wow look what i coded, and im 10 years old!

from flask import Flask, render_template_string, request
app = Flask(__name__)
HTML_FORM = '''
<!doctype html>
<html>
<head>
<title>Chess Info Form</title>
</head>
<body style="font-family: Arial; background-color: #f9f9f9; padding: 20px;">
<h2>Tell us about you!</h2>
<form method="post">
<label>Chess.com username:</label><br>
<input type="text" name="username" required><br><br>
<label>Favorite color:</label><br>
<input type="color" name="color"><br><br>
<label>Do you like this website?</label><br>
<input type="radio" name="like" value="Yes" required> Yes<br>
<input type="radio" name="like" value="No"> No<br><br>
<input type="submit" value="Submit">
</form>
{% if result %}
<h3>Thanks for your input!</h3>
<p><strong>Username:</strong> {{ result.username }}</p>
<p><strong>Favorite Color:</strong> <span style="color: {{ result.color }}">{{ result.color }}</span></p>
<p><strong>Likes Website:</strong> {{ result.like }}</p>
{% endif %}
</body>
</html>
'''
@app.route("/", methods=["GET", "POST"])
def home():
if request.method == "POST":
result = {
"username": request.form.get("username"),
"color": request.form.get("color"),
"like": request.form.get("like")
}
return render_template_string(HTML_FORM, result=result)
return render_template_string(HTML_FORM, result=None)
Go to: Pythonaywere.com. create an acc, then go to New website, run this code
Cool! *I am not understanding a letter of this*

from flask import Flask, render_template_string, request
app = Flask(__name__)
HTML_FORM = '''
<!doctype html>
<html>
<head>
<title>Chess Info Form</title>
</head>
<body style="font-family: Arial; background-color: #f9f9f9; padding: 20px;">
<h2>Tell us about you!</h2>
<form method="post">
<label>Chess.com username:</label><br>
<input type="text" name="username" required><br><br>
<label>Favorite color:</label><br>
<input type="color" name="color"><br><br>
<label>Do you like this website?</label><br>
<input type="radio" name="like" value="Yes" required> Yes<br>
<input type="radio" name="like" value="No"> No<br><br>
<input type="submit" value="Submit">
</form>
{% if result %}
<h3>Thanks for your input!</h3>
<p><strong>Username:</strong> {{ result.username }}</p>
<p><strong>Favorite Color:</strong> <span style="color: {{ result.color }}">{{ result.color }}</span></p>
<p><strong>Likes Website:</strong> {{ result.like }}</p>
{% endif %}
</body>
</html>
'''
@app.route("/", methods=["GET", "POST"])
def home():
if request.method == "POST":
result = {
"username": request.form.get("username"),
"color": request.form.get("color"),
"like": request.form.get("like")
}
return render_template_string(HTML_FORM, result=result)
return render_template_string(HTML_FORM, result=None)
Go to: Pythonaywere.com. create an acc, then go to New website, run this code
Cool! *I am not understanding a letter of this*
Its called coding baibe
from flask import Flask, render_template_string, request
app = Flask(__name__)
HTML_FORM = '''
<!doctype html>
<html>
<head>
<title>Chess Info Form</title>
</head>
<body style="font-family: Arial; background-color: #f9f9f9; padding: 20px;">
<h2>Tell us about you!</h2>
<form method="post">
<label>Chess.com username:</label><br>
<input type="text" name="username" required><br><br>
<label>Favorite color:</label><br>
<input type="color" name="color"><br><br>
<label>Do you like this website?</label><br>
<input type="radio" name="like" value="Yes" required> Yes<br>
<input type="radio" name="like" value="No"> No<br><br>
<input type="submit" value="Submit">
</form>
{% if result %}
<h3>Thanks for your input!</h3>
<p><strong>Username:</strong> {{ result.username }}</p>
<p><strong>Favorite Color:</strong> <span style="color: {{ result.color }}">{{ result.color }}</span></p>
<p><strong>Likes Website:</strong> {{ result.like }}</p>
{% endif %}
</body>
</html>
'''
@app.route("/", methods=["GET", "POST"])
def home():
if request.method == "POST":
result = {
"username": request.form.get("username"),
"color": request.form.get("color"),
"like": request.form.get("like")
}
return render_template_string(HTML_FORM, result=result)
return render_template_string(HTML_FORM, result=None)
Go to: Pythonaywere.com. create an acc, then go to New website, run this code