Created
May 20, 2018 21:02
-
-
Save Cibernomadas/837c2830d2a5e06b6c9802aaa913606a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def indexFn(): | |
return ''' | |
<html> | |
<head> | |
<title>Calculadora</title> | |
</head> | |
<body> | |
<h1>La calculadora de cibernóadas</h1> | |
<p> | |
Esto es una calculadora muy sencilla. Solo adminte sumas y restas. | |
</p> | |
<p> | |
Por ejemplo, si quieres sumar dos números tienes que navegar a <a href="/suma/100/10">/suma/100/10</a> | |
</p> | |
<p> | |
Por el contrario, si quieres restar tienes que navegar a <a href="/resta/100/10">/resta/100/10</a> | |
</p> | |
</body> | |
</html>''' | |
@app.route('/suma/<int:num_a>/<int:num_b>') | |
def sumaFn(num_a, num_b): | |
return "{}".format(num_a + num_b) | |
@app.route('/resta/<int:num_a>/<int:num_b>') | |
def restaFn(num_a, num_b): | |
return "{}".format(num_a - num_b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment