Skip to content

data.gdp #16

Description

@diemxuan0209-gif

import streamlit as st

st.set_page_config(page_title="App Tính Trả Góp Quốc Gia")

st.title("🌍 App Tính Trả Góp Theo Quốc Gia")

Danh sách quốc gia và lãi suất tham khảo

countries = {
"Việt Nam": 12,
"Hoa Kỳ": 8,
"Nhật Bản": 4,
"Hàn Quốc": 6,
"Singapore": 5
}

country = st.selectbox("Chọn quốc gia", list(countries.keys()))

price = st.number_input(
"Giá trị sản phẩm",
min_value=0.0,
value=10000000.0
)

down_payment = st.number_input(
"Trả trước",
min_value=0.0,
max_value=price,
value=2000000.0
)

months = st.selectbox(
"Thời hạn trả góp (tháng)",
[6, 12, 24, 36, 48, 60]
)

Lãi suất theo quốc gia

annual_rate = countries[country]
monthly_rate = annual_rate / 100 / 12

loan_amount = price - down_payment

if st.button("Tính trả góp"):
monthly_payment = (
loan_amount * monthly_rate *
(1 + monthly_rate) ** months
) / (
(1 + monthly_rate) ** months - 1
)

total_payment = monthly_payment * months
total_interest = total_payment - loan_amount

st.success(f"Quốc gia: {country}")
st.write(f"Số tiền vay: {loan_amount:,.0f}")
st.write(f"Lãi suất năm: {annual_rate}%")
st.write(f"Tiền góp mỗi tháng: {monthly_payment:,.0f}")
st.write(f"Tổng tiền lãi: {total_interest:,.0f}")
st.write(f"Tổng phải thanh toán: {total_payment:,.0f}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions