-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (22 loc) · 798 Bytes
/
app.py
File metadata and controls
28 lines (22 loc) · 798 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
import streamlit as st
import pandas as pd
st.title("💰 Expense Tracker App")
if "expenses" not in st.session_state:
st.session_state.expenses = []
expense_name = st.text_input("Enter Expense Name")
expense_amount = st.number_input("Enter Amount", min_value=0.0)
if st.button("Add Expense"):
if expense_name and expense_amount:
st.session_state.expenses.append({
"Name": expense_name,
"Amount": expense_amount
})
st.success("Expense Added Successfully!")
else:
st.warning("Please enter both name and amount.")
if st.session_state.expenses:
df = pd.DataFrame(st.session_state.expenses)
st.subheader("Your Expenses")
st.dataframe(df)
total = df["Amount"].sum()
st.subheader(f"Total Expense: ₹ {total}")