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.
This comment is hidden because it contains spoiler information about the solution
As you can see in my post above, I am taking in to considerantion that you can't have 0.whatever population by applying Math.round to my result (I am trying with Math.ceil as well and is not working). Is still not working for me, and, I am taking into consideration that the result should be >= to p. Can somebody help? or point me in the right direction without just giving me a dislike :|
This comment is hidden because it contains spoiler information about the solution
Ok, I'm still not totally convinced but I've already made the corresponding adjustments and passed the tests. Thanks for your comments!
I don't think this will ever get resolved. Some people can't handle fractional people, others can't deal with continious functions. It's the battle of the ages.
@heblopez The error is right there, in the year 1...3 in the output of your solution. Population is the count of a species living in a certain area (in the context of the kata, the species is human). As stated by RileyHunter, you can't count a person partially. For example, let's look at the output of your solution.
1141.4
, there are 1141 and 0.4 people in a certain area. What does the0.4
indicates? You can't just have a person counted as0.4
.Read the post of RileyHunter again, you can't have fractional people.
"In the last basic test i get this error:
IN: 1000 2.0 50 1214 Year 1: 1070.0 Year 2: 1141.4 Year 3: 1214.228
3 should equal 4"
The instructions state the following: "the function nb_year should return n number of entire years needed to get a population greater or equal to p."
So even if I do not consider the decimals in the test I get the error, the result of year 3 already reaches the target quantity "p" that is received as a parameter. Where is the error?
For the first test case, your solution suggests that after year two there are 1858.75 people in the population - but can you really have three quarters of a person? Think about what data types you're using here and read the description carefully.
I have the same error that @Xeferis mentions, when I click on the "Attempt" button I get the same message: "expected 3 to equal 4" but I don't understand why.
Great solution!