How to define factorial and square root by my own without any library & module? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to define factorial and square root by my own without any library & module?

17th Aug 2019, 6:18 PM
Avinash
Avinash - avatar
4 Answers
17th Aug 2019, 6:28 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 4
No one who keeps you from doing this. the function needs 2 lines of code and the call 1 line. so it’s 3 lines in total. you should be able to do this by yourself.
18th Aug 2019, 6:12 AM
Lothar
Lothar - avatar
+ 3
Square root can be calculated by the formula: n to the power of 0.5. so if you want to get the square root of 49 you can use this expression: print(49 ** 0.5) # output is 7.
17th Aug 2019, 7:13 PM
Lothar
Lothar - avatar
+ 2
I want to define a function not to just get that value.
17th Aug 2019, 7:53 PM
Avinash
Avinash - avatar