Nov-05-2020, 01:17 PM
@buran - Yes, I could have messed up with my interpretation. Thanks for the suggestion.
@perfringo - Thanks a ton for clearly explaining it.
and @deanhystad - Thanks for the better way of coding. I was trying to solve it in a crude way and then learn from the alternate solutions after solving it. When I was coding this, I had a feeling that I was not doing it the right way but, first wanted to solve it one way or the other and later try for better way. But, looks like I have totally screwed the way functions are supposed to be used. Thanks for correcting me.
I have started solving questions on http://codewars.com and this is one among them.
write calculations using functions and get the results. Let's have a look at some examples:
seven(times(five())) # must return 35
four(plus(nine())) # must return 13
eight(minus(three())) # must return 5
six(divided_by(two())) # must return 3
I am first trying to solve it (could be a crude way) and once I am done, I am finding other solutions and learning from them.
Thanks for all your suggestions. I am working on improving myself.
@perfringo - Thanks a ton for clearly explaining it.
and @deanhystad - Thanks for the better way of coding. I was trying to solve it in a crude way and then learn from the alternate solutions after solving it. When I was coding this, I had a feeling that I was not doing it the right way but, first wanted to solve it one way or the other and later try for better way. But, looks like I have totally screwed the way functions are supposed to be used. Thanks for correcting me.
I have started solving questions on http://codewars.com and this is one among them.
write calculations using functions and get the results. Let's have a look at some examples:
seven(times(five())) # must return 35
four(plus(nine())) # must return 13
eight(minus(three())) # must return 5
six(divided_by(two())) # must return 3
I am first trying to solve it (could be a crude way) and once I am done, I am finding other solutions and learning from them.
Thanks for all your suggestions. I am working on improving myself.