-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (20 loc) · 678 Bytes
/
app.py
File metadata and controls
24 lines (20 loc) · 678 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
##finance dashboard issue :]
from flask import Flask, render_template_string
app = Flask(__name__)
# Sample expense data
expenses = [
{"category": "Food", "amount": 120},
{"category": "Rent", "amount": 800},
{"category": "Transport", "amount": 60},
]
@app.route("/")
def dashboard():
total = sum(e["amount"] for e in expenses)
categories = ", ".join(e["category"] for e in expenses)
return render_template_string("""
<h1>Finance Dashboard</h1>
<p><b>Total Spending:</b> ${{ total }}</p>
<p><b>Categories:</b> {{ categories }}</p>
""", total=total, categories=categories)
if __name__ == "__main__":
app.run(debug=True)