test.assert_equals(amort(5.6, 133555, 60, 53), "num_payment 53 c 2557 princ 2464 int 93 balance 17571")
I kept failing this due to rounding - my int was 94
Hello, you've been approaching this kata with the same strategy I used, but you've solved it in a much more elegant way. Very nice!
If you would use python2 formatting, you would get 5 miliseconds faster executing time :)
I tried that and the system asked me something to the effect of "Where is the code?" and wouldn't let me submit it.
what he said, just a way to format the string
proper string formatting, there are various ways, only really matters for more complex cases
This comment is hidden because it contains spoiler information about the solution
For those "eval" prognosticators of danger -
I wholeheartedly agree - and if I were to actually use this in a program - then whereever "basicop" was being called would be an additional function that verified that you were entering valid data.
But for an 8kyu problem, this is the simple, basic solution.
using eval() on unknown input is dangerous!
I think a lot of folk use single letters that imply a data type. I know I do.
e.g. c => characters, i => integer, l => list, e => generic element
probably bc I copied it ahah
I'm guessing they used c instead of d because it was returning a string, thus c for character?
Ya, I gradually worked my way to this little one-liner =)
very similar to what I did
this is what I did as well!