can someone tell me what i'm doing wrong? on problem set 1, the compound interest one. I finally got everything to work except the round function. I put it inside the loop but it only rounds the result for the first month. I can post my code if it helps.
just realized I can attach files
What version are you using - 3.0 print is a function, so that could create errors. Also, There's a space between float, take it out, That may help.
using 2.7, ill try taking that space out
also, make a function out of it, instead of while, and use the variables as arguments. Call it again using recursion like: def functionname(): ....code; a+= 1.0; functionname(); ...
okay
but it works exactly like it should until I try to round. shouldn't it loop with everything else?
yeah. I just like functions because they look cleaner and they're easier to work with for me. It's not necessary
sorry im just new to this just trying to figure out what im missing.
I'm not familiar with round and float because I never had to extensively use it. Sorry You're code looks fine
yea not really an error technically, its just not giving me the result I want. it rounds the value once even though its inside the loop
ok np I appreciate the help
I would do v += 0.00000000000; I'm gone now.
ok thanks
yeah ok
The `round` function returns the rounded value, it doesn't change the given variable. you should do `v = round(v,2)`
oh, ok thank you.
Join our real-time social learning platform and learn together with your friends!