java to python
Christian Stockhammer
christian.stockhammer at students.uni-linz.ac.at
Fri Nov 8 10:17:02 EST 2002
Hello List!
I've got homework I have to solve in python but i just know a little bit
java and i got my homework to run in java. Is there anybody who can help me
to translate that code to python?
Here it is:
public class Tilgung{
public static void main(String [] args){
tilgungsplan(100000.0,5.0,20000.0);
}
static void tilgungsplan(double schuld,double zinsfaktor,double tilgung){
double zinsen;
double echteTilgung;
System.out.println("Periode Restschuld Zinsen Tilgung");
for(int i=0;i<5;i++){
zinsen=(schuld*zinsfaktor)/100;
echteTilgung=tilgung-zinsen;
System.out.println(" "+i+" "+schuld+" "+zinsen+" "+echteTilgung);
schuld=schuld-echteTilgung;
}
System.out.println(" Restzahlung: "+schuld);
}
}
This is what it produces: (it is a calculator for paying back a credit)!!!
Periode Restschuld Zinsen Tilgung
0 100000.00 5000.00 15000.00
1 85000.00 4250.00 15750.00
2 69250.00 3462.50 16537.50
3 52712.50 2635.63 17364.38
4 35348.13 1767.41 18232.59
Restzahlung: 17115.53
Is there anybody who is willing to help me. I really appreciate any
suggestions
Cheers Christian
More information about the Python-list
mailing list