I am sorry but could someone tell me how to calculate square roots of large numbers such as "1488099328131240642930278400000000" very precisely (round up to lower int) so that if I make x^2 I get "1488099328131240642930278400000000"±10 (approximately) as an output?
My code works fine except I just don't understand why sometimes you need to return only one pair of integers when several others would work and sometimes you need to return more but not every single one of them.
Could someone explain me this please?
EN
On each iteration you call the method lower(). This happens 26 times.
It's better to do this once before the loop and save it in a variable, and then access it.
RU
На каждой итерации вы вызываете метод lower(). Это происходит 26 раз.
Лучше сделать это один раз перед циклом и сохранить в переменной, а затем обращаться к ней.
That is not a best practise at all!
In Python, you may use
decimal
module.I am sorry but could someone tell me how to calculate square roots of large numbers such as "1488099328131240642930278400000000" very precisely (round up to lower int) so that if I make x^2 I get "1488099328131240642930278400000000"±10 (approximately) as an output?
I am surprise because I tought everyone used the way I used but seen none.
Was the way I did the way it was intented ?
This comment is hidden because it contains spoiler information about the solution
My bad I re-read the description and saw that it was pairs between 1 and n and not sum(range(1,n)).
Thank you anyway !
I don't understand what you mean. You have to return all pairs that work and only these pairs. Moreover it seems you understood since you passed.
My code works fine except I just don't understand why sometimes you need to return only one pair of integers when several others would work and sometimes you need to return more but not every single one of them.
Could someone explain me this please?
This comment is hidden because it contains spoiler information about the solution
Why is it not an issue ? The result is not the good one since D is not as small as possible.
Not an issue with the kata.
Why [[69, 130], [87, 1310], [3, 4]] should return [[18078, 34060], [2262, 34060], [25545, 34060]] and not [[3588, 6812], [435, 6812], [5109, 6812]] since Fraction(69,130)+Fraction(87,1310)+Fraction(3,4) --> Fraction(9177, 6812)?
Can someone give me a hint on this one ?
How do you know? Here is an exactly same kata, and there're definitely more approved ones.
I will unpublish it until its 100% working
Loading more items...