Created
September 18, 2019 14:37
-
-
Save jahir/bf95f9b1a5318718bc42fa0121f7bb47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
(darlehen, zinssatz, monatlich) = (float(x) for x in sys.argv[1:]) | |
monate = 0 | |
zinsen = 0.0 | |
while darlehen > 0: | |
monate += 1 | |
zins = darlehen * zinssatz / 100 / 12 | |
zinsen += zins | |
darlehen = darlehen - monatlich + zins | |
# print("%d. Monat: %.2f € übrig, %.2f € Zinsen" % (monate, darlehen, zinsen)) | |
print('Schuldenfrei nach %d Monaten (%d Jahre %d Monate), %.2f € Zinsen bezahlt' % (monate, monate / 12, monate % 12, zinsen)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment