Retrieving Small Precision Decimal (retired)
Description:
Someone has mixed all my data and i need your help to reorganize them !
You will be given a number which can be either integer (1
), float (1.23
) or string representation of a float ("77.7"
) or integer ("42"
).
Your job is to return a float
with the first 2 decimals of the argument given (n
) as a string
if it doesn't have a decimal part, then return None
.
If the given argument have more than 2 decimals digits, make sure it is follows these 2 rules:
- if the 3rd decimal digit is below 5, it should be round down
- if the 3rd decimal digit is 5 are above, it should be round up
We want only the 2 decimals, do not return anything above 1
Let's keep it easy
Do not return the original argument type, return every argument as either float
or None
(according to the rule explained above)
Since we care only of decimal, you should return a value always between 0 and 1.
Similar Kata:
Stats:
Created | Jun 20, 2021 |
Warriors Trained | 12 |
Total Skips | 0 |
Total Code Submissions | 31 |
Total Times Completed | 6 |
Python Completions | 6 |
Total Stars | 0 |
% of votes with a positive feedback rating | 0% of 5 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 4 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |