Cov txheej txheem:

Nab hab sej txoj haujlwm - Cov paj laum uas tau koom nrog txhua hli/Kev tso nyiaj: 5 Kauj Ruam
Nab hab sej txoj haujlwm - Cov paj laum uas tau koom nrog txhua hli/Kev tso nyiaj: 5 Kauj Ruam

Video: Nab hab sej txoj haujlwm - Cov paj laum uas tau koom nrog txhua hli/Kev tso nyiaj: 5 Kauj Ruam

Video: Nab hab sej txoj haujlwm - Cov paj laum uas tau koom nrog txhua hli/Kev tso nyiaj: 5 Kauj Ruam
Video: Tswv Yexus lub neej thaum pib txug thaum xaus 2024, Hlis ntuj nqeg
Anonim
Nab hab sej Kev Pabcuam - Sib Piv Cov Nyiaj Txiag nrog rau Kev Pabcuam Ib Hlis/Deposit
Nab hab sej Kev Pabcuam - Sib Piv Cov Nyiaj Txiag nrog rau Kev Pabcuam Ib Hlis/Deposit
Python Txoj Haujlwm - Sib Txawv Txaus Siab Nrog Rau Kev Pabcuam Ib Hlis/Deposit
Python Txoj Haujlwm - Sib Txawv Txaus Siab Nrog Rau Kev Pabcuam Ib Hlis/Deposit

Qhov kev zov me nyuam los xam cov paj laum nrog cov nyiaj pab txhua hli thaum kawg ntawm lub hlis.

Cov qauv coj los ntawm TheCalculatorSite.com:Compound txaus siab rau tus thawj xibfwb: P (1 + r/n)^(nt) Yav tom ntej tus nqi ntawm koob: PMT × (((1 + r/n)^nt - 1)/(r/ n))

Kauj Ruam 1: Tau Cov Ntaub Ntawv Los Ntawm Tus Neeg Siv

Tau txais cov ntaub ntawv los ntawm tus neeg siv
Tau txais cov ntaub ntawv los ntawm tus neeg siv

Nug tus neeg siv kom muab cov ntaub ntawv xav tau:

principalinput = input ("Enter tus thawj xibfwb:") annualrateinput = input ("Enter annual rate:") numberoftimescompoundedinput = input ("Enter number of times that the interest is compounded per year:") yearsinput = input ("Time in years:") monthlycontributioninput = input ("Sau cov nyiaj pab txhua hli:")

Kauj ruam 2: Hloov Cov Ntaub Ntawv

Hloov Cov Ntaub Ntawv
Hloov Cov Ntaub Ntawv

Cov ntaub ntawv tau nkag los ua cov hlua uas yuav tsum tau hloov pauv mus rau hauv integers# Hloov cov tswv yim nkag los ntawm cov hlua mus rau hauv integersprincipal = int (tus thawj tswj hwm input) annualrate = (int (annualrateinput))/100 tus naj npawb timescompounded = int (numberoftimescompoundedinput) years = int (yearsinput) monthlycontribution = int (kev koom tes koom nrog txhua hli)

Kauj Ruam 3: Xam Cov Nyiaj Txiag Ua Ke Ntxiv nrog Tus Thawj Xib Fwb

Xam qhov paj laum ntxiv rau tus Thawj Xib Fwb
Xam qhov paj laum ntxiv rau tus Thawj Xib Fwb

Ua ntej, xam cov paj laum ntxiv rau tus thawj xibfwb: # xam cov paj laum ntxiv rau tus thawj xibfwb thawj zaug naj npawb = (1 + (txhua xyoo/tus naj npawb xov tooj sib npaug)) # luam tawm ("Tus lej ua ntej:", tus lej ua ntej) tau nce zog = (numberoftimescompounded * xyoo) # print ("Raised kom muaj hwj chim: ", tsa kom siab zog) sib koom ua keinterestplusprincipal = tus thawj xibfwb*(tus lej ua ntej ** tus lej txhawb nqa) luam tawm (" Cov paj tau paj ntxiv rau tus thawj xibfwb yog: ", compoundinterestplusprincipal)

Kauj Ruam 4: Xam Tus Nqi Yav Tom Ntej

Xam Lub Neej Yav Tom Ntej
Xam Lub Neej Yav Tom Ntej

Tom qab ntawd xam tus nqi yav tom ntej nrog tso nyiaj# Tam sim no xam tus nqi yav tom ntej nrog tso nyiaj ua thaum kawg ntawm lub sijhawm# Siv tus lej: Them Ib Hlis × ((((1 + r / n)^(nt)) - 1) / (r /n)) # r = tus paj laum txhua xyoo # n = tus naj npawb ntawm cov sib txuas hauv ib lub sijhawm (feem ntau hauv lub hlis) # t = sijhawm cov nyiaj tau nqis peev (feem ntau yog xyoo)

oneplus = (1+ (annualrate/numberoftimescompounded)) liftedtopower2 = ((numberoftimescompounded*years)) ratedividedbynumberoftimes = annualrate/numberoftimescompoundedhalfdone = (((oneplus ** liftedtopower2) -1)/ratedividedbynumberoftimes) futurevaluewithd nrog kev tso nyiaj: ", tus nqi yav tom ntej nrog kev tso nyiaj) totalamount = compoundinterestplusprincipal + futurevaluewithdeposits print (" Total Amount: ", totalamount)

Kauj ruam 5: Code

# Txoj haujlwm los xam cov paj laum nrog rau kev txhawb nqa txhua hli thaum kawg ntawm lub hlis

# Ua ntej suav cov paj laum rau tus thawj xib fwb siv tus lej: A = P (1 + r/n) ** (nt) # r = tus paj laum txhua xyoo # n = tus naj npawb ntawm cov sib txuas ib lub sijhawm (feem ntau hauv lub hlis) # t = lub sijhawm thawj coj = input ("Enter tus thawj xibfwb:") annualrateinput = input ("Enter annual rate:") numberoftimescompoundedinput = input ("Enter number of times that the interest is compounded per year:") yearsinput = input ("Time in years:") monthlycontributioninput = input ("Nkag mus rau cov nyiaj pab txhua hli:") # Hloov cov tswv yim nkag los ntawm cov hlua mus rau cov lej tseem ceeb = int (tus thawj xibfwb input) txhua xyoo = (int (txhua xyoo) int (kev them nyiaj txhua hli koom nrog) luam tawm ("Tus thawj xib fwb nkag mus yog:", tus thawj xibfwb) luam tawm ("Tus nqi txhua xyoo hauv daim ntawv zauv yog:", txhua xyoo) luam tawm ("Tus naj npawb ntawm lub sijhawm nws yuav suav nrog hauv ib xyoos yog:", tus naj npawb sijhawm sib npaug) print ("Tus naj npawb ntawm xyoo nws yuav muab sib xyaw: ", xyoo) luam tawm (" Cov nyiaj pab txhua hli yog: ", kev koom nrog txhua hli) # suav cov paj laum ntxiv rau tus thawj xibfwb thawj tus lej = (1 + (txhua xyoo/tus naj npawb sijhawm sib sau ua ke)) # luam tawm (" Tus lej ua ntej: ", tus lej ua ntej) tau nce zog = (tus lej nyob rau ib lub sijhawm *) xyoo) # luam tawm ("Raised to power:", liftedtopower) compoundinterestplusprincipal = tus thawj xibfwb*(tus lej thawj ** tus lej **topower) luam tawm ("Cov paj laum ntxiv rau tus thawj xibfwb yog:", compoundinterestplusprincipal) # Tam sim no xam tus nqi yav tom ntej nrog tso nyiaj ua los ntawm qhov kawg ntawm lub sijhawm # Siv tus lej: Them Ib Hlis × ((((1 + r/n)^(nt)) - 1)/(r/n)) # r = tus paj laum txhua xyoo # n = tus naj npawb ntawm cov sib txuas ib lub sijhawm (feem ntau hauv lub hlis) # t = sijhawm cov nyiaj tau nqis peev (feem ntau hauv xyoo) oneplus = (1+ (txhua xyoo/tus naj npawb ntawm cov sij hawm sib sau ua ke)) tau tsa lub zog 2 = ((tus naj npawb sij hawm siv tau*xyoo)) ratedividedbynumberoftimes = txhua xyoo/tus naj npawb cov sij hawm siv tau ib nrab ua = (((oneplus* *tsa lub zog 2) -1)/ntsuas sib faib los ntawm tus lej roftimes) futurevaluewithdeposits = txhua hli kev koom tes*ib nrab luam tawm ("Yav tom ntej tus nqi nrog tso nyiaj:", yav tom ntej tus nqi nrog kev tso nyiaj) totalamount = compoundinterestplusprincipal + futurevaluewithdeposits print ("Total Amount:", totalamount)

Pom zoo: