修改了演示代码

This commit is contained in:
2025-10-27 20:29:38 +08:00
parent e351212b72
commit 6271f413a0
9 changed files with 24 additions and 216 deletions

21
app.py
View File

@@ -1,11 +1,14 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
# 简单的加法计算器
from flask import Flask
app = Flask(__name__)
def add_numbers(a, b):
"""计算两个数字的和"""
return a + b
@app.route("/")
def hello():
return app.send_static_file("index.html")
# 获取用户输入
print("简单的加法计算器")
num1 = float(input("请输入第一个数字: "))
num2 = float(input("请输入第二个数字: "))
# 计算并输出结果
result = add_numbers(num1, num2)
print(f"{num1} + {num2} = {result}")