Python root | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python root

How to calculate the root of a number through a python?

18th Mar 2022, 2:14 AM
Nexus
Nexus - avatar
2 Answers
18th Mar 2022, 2:51 AM
Gordon
Gordon - avatar
+ 1
Calculate integer square root: def intsqrt(n): x = 2 for i in range(50): x += n//x x >>= 1 return x
20th Mar 2022, 12:43 AM
Brian
Brian - avatar