#list of loans
loans = [
{
"loan_price": 700,
"remaining_months": 9,
"repayment_interval": "monthly",
"future_value": 1000,
},
{
"loan_price": 500,
"remaining_months": 13,
"repayment_interval": "bullet",
"future_value": 1000,
},
{
"loan_price": 200,
"remaining_months": 16,
"repayment_interval": "bullet",
"future_value": 1000,
},
{
"loan_price": 900,
"remaining_months": 16,
"repayment_interval": "bullet",
"future_value": 1000,
},
]
#empty dictionary
inexpensive_loans = []
loan_price = loans.get(loans[loan_price])
for loan_price in loans:
if loans[loan_price] <= 500:
inexpensive_loans.append(loans[loan_price])
print(inexpensive_loans)
I want to extract the loans where the loan_price is under 500 and put them into inexpensive_loans
.
Aucun commentaire:
Enregistrer un commentaire