Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Same here! Yours looks more elegant than mine. I used a for loop to creates the string! oops
Omg, i used Insert too, thank you :D
You're right, man. In this kata, instead of learning programming, we learn to pass tests
thank you, if it wasn't for your comment, I'd have given up on this kata!
Although the kata is interesting and challenging, it brings a lot of frustration at the end. I've spent almost as much time passing the tests as I've done writing the code, just because some things were not clear from the task formulation.
Examples and sample tests imply that all money values are formatted xxx.xx (e.g 14.32). Only when taking random tests one realises, that this is not the case: sometimes they are xx.x and sometimes even integers. I think that such possibilities should be explicitly stated when formulating the task.
It's really easy not to see that TWO spaces are required after "Total expense" and "Average expense". Maybe give an extra hint?
The "\n" and "\r\n" thing is confusing. When I'm using "r\n" in my own environment it produces extra blank lines that are clearly not needed, but you can't pass the tests when using "\n".
my result in visual studio
Original Balance: 1000.00
125 Market 125.45 Balance 874.55
126 Hardware 34.95 Balance 839.60
127 Video 7.45 Balance 832.15
128 Book 14.32 Balance 817.83
129 Gasoline 16.10 Balance 801.73
Total expense 198.27
Average expense 39.65
How then to explain the fact that in visual studio I get the necessary output?
In "125 Market 125.45 Balance 87455"
87455
"seems" to be an int (in a string, OK) when874.55
is expected.BTW no need to be unpleasant, that will bring nothing:-) I simply try to show you where there is a problem!
And hello, mr.GEniuses who always sure of his code.
Pay attention to the line of the average price. There is a number with a dot.
How can you say that I return int when string is returned?
Not an issue of the kata but of your code. Uou are returning int, ex:
Don't post issue unless you are absolutely sure of your code...
when compiling in Visual Studio I get the correct answer with 2 decimal places. And here I get the output like this:
Original Balance: 1000.00
125 Market 125.45 Balance 87455
126 Hardware 34.95 Balance 83960
127 Video 7.45 Balance 83215
128 Book 14.32 Balance 81783
129 Gasoline 16.10 Balance 80173
Total expense 19827
Average expense 3965.4
I tried both Math.Round, and String.Format and ToString ("#. ##") nothing works.