Write a function getEvolutionRateMessage which takes two numbers before & after. The before value is the initial value of the evolution. The af...
For further actions, you may consider blocking this person and/or reporting abuse
Some JavaScript.
Hi there, nice and short solution! I believe the case for the values
0
&27.35
wont give what you expected. But you are in the right path for sure.Fixed!
I wrote it in Python, kept it as short as possible while maintaining clarity. 😎
Neat! I like what they did with this new string interpolation thing in Python.
I Didn't know it was called a polarity. Learning new things every day. Yay!
Since no one proposed a PHP solution, here I am!
getEvolutionRate()
unit tests:getEvolutionRateMessage()
unit tests:I love those guards you are puting in your code. Really makes me want to go back and do PHP with you like the good ol'times!
Let's do a side project together
All this talk of evolution makes me want to Go play Pokemon again. Holy crap I haven't played that in a long time!
rate.go
rate_test.go
I always love your take at these challenges in Go. I should get started soon. Looking sharp as always!
And yes, Pokemon is just timelessly good. I could play it all my life haha!
Ah shucks, I am humbled by the praise.
You should, Go is a very easy language to pick up and use.
Only part that may require a little more effort to understand is the concurrency related features of it but just pick those up as you need them.
Haskell:
I long awaited this one. Haha!
Here is a Javascript arrow function, that uses nested ternary operators. Someone probably already posted this answer, but hey main point is that I took the challenge and solved by myself.
Thanks for showing us your solution. What's important is what you achieve at the end of the day!
Perl solution. I still don't understand how the values are computed for zeroes, but it passes the tests :-)
Imagine that instead of going from 0 to 27.35, you are going from 0.0000000001 to 27.35. I think you'll have your answer here. 😉
My javascript solution :
My knowledge of statistics is a bit rusty (yet I didn't use rust for this challenge), but I think that an increase from 0 to anything is basically an infinite rate and a decrease from anything to 0 is a negative 100% rate, so I disagree with the examples 3 and 4 and have written my solution accordingly.
Haskell, of course
Output
python
{ % gist gist.github.com/devparkk/092171076... %}
The code will throw an error if you pass in the following parameters
getEvolutionRateMessage 0 27.35
as you're dividing by 0.Oyeeeeee
Thanks a lot , man
I appreciate it ...
Can u help me with how to publish my codes here in comment section ...
I don't really understand this markdown and all ...
Hi Prakash, you can refer to this link to see how code syntax highlighting works in markdown.
Thank you