Created
June 19, 2021 10:24
-
-
Save shinysu/ae666975aeff817da4508583d995cde6 to your computer and use it in GitHub Desktop.
currency_converter_1
This file contains hidden or 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, render_template,request | |
app = Flask(__name__) | |
@app.route('/', methods=["GET", "POST"]) | |
def index(): | |
if request.method == "POST": | |
from_currency = request.form["from_currency"] | |
to_currency = request.form["to_currency"] | |
amount = request.form["amount"] | |
print(from_currency) | |
print(to_currency) | |
print(amount) | |
return render_template('index.html') | |
if __name__ == '__main__': | |
app.run(debug=True) |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Currency Converter</title> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> | |
</head> | |
<body> | |
<div class="container"> | |
<h1> Currency Converter</h1> | |
<br> | |
<form action="#" method="POST"> | |
<div class="row"> | |
<div class="col-md-2"> | |
From currency: | |
</div> | |
<div class="col-md-3"> | |
<select class="form-select" aria-label="Default select example" name="from_currency"> | |
<option selected>Choose the currency</option> | |
<option value="USD">USD</option> | |
<option value="INR">INR</option> | |
<option value="EUR">EUR</option> | |
</select> | |
</div> | |
</div> | |
<br> | |
<div class="row"> | |
<div class="col-md-2"> | |
To currency: | |
</div> | |
<div class="col-md-3"> | |
<select class="form-select" aria-label="Default select example" name="to_currency"> | |
<option selected>Choose the currency</option> | |
<option value="USD">USD</option> | |
<option value="INR">INR</option> | |
<option value="EUR">EUR</option> | |
</select> | |
</div> | |
</div> | |
<br> | |
<div class="row"> | |
<div class="col-md-2"> | |
Enter the amount: | |
</div> | |
<div class="col-md-5"> | |
<input type="text" name="amount"> | |
<button type="submit" value="submit">Convert</button> | |
</div> | |
</div> | |
<br> | |
<div class="row"> | |
<div class="col-md-2"> | |
Converted amount: | |
</div> | |
<div class="col-md-3"> | |
<input type="text" name="converted_amt" disabled> | |
</div> | |
</div> | |
</form> | |
</div> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment