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

Sort:
TheBestAllthewayrival

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

ZackWillCheckU

amazing

NgAnhh_12

Cool

Ekaterina_Alternative

Really good buddy, I tell u as an expert!

Micahz12

Gg

TheBestAllthewayrival

Thx guys

MaestroDelAjedrez2025

Thanks guys

TheBestAllthewayrival

Bro stole my talk

MaestroDelAjedrez2025

Who stole your talk?

TheBestAllthewayrival
MaestroDelAjedrez2025 escreveu:

Thanks guys

You

epicsneyser3000
TheBestAllthewayrival wrote:

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*

MaestroDelAjedrez2025

Was I really the guy who wrote this?

TheBestAllthewayrival

Yes

MaestroDelAjedrez2025

What did I write?

TheBestAllthewayrival
epicsneyser3000 escreveu:
TheBestAllthewayrival wrote:

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

MaestroDelAjedrez2025

I didn't type those things

SOUNDWAVE_SUPERIOR21

Is there a way to run this without an account?

MaestroDelAjedrez2025

I don't think so

SOUNDWAVE_SUPERIOR21

Or another website?

MaestroDelAjedrez2025

All chess.com members have an account