-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
42 lines (30 loc) · 918 Bytes
/
app.py
File metadata and controls
42 lines (30 loc) · 918 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from flask import Flask,render_Template,request
app=Flask(__name__)
def suma(n1,n2):
return n1+n2
def resta(n1,n2):
return n1-n2
def multiplicacion(n1,n2):
return n1*n2
def divicion(n1,n2):
return n1/n2
@app.route('/')
def home():
return '<h1>hola mundo </h1>'
@app.route('/saludo')
def saludo():
return '<p> Bienvenidos a la clase de pyton </p>'
@app.route('/index')
def index():
usu='pepito perez'
return render_Template('index.html',usuario=usu)
@app.route('/operacion',methods=['GET','POST'])
def oper():
if request.method=='post':
numero1 = float(request.form.get('numero1'))
numero2 = float(request.form.get('numero2'))
operacion = (request.form.get(óperacion)
if operacion='+'
resultado= suma(numero1,numero2)
return render_Template('index.html',numero = f'{numero1} + {numero2} = {resultado}')
app.run(debug=True)