python square root without math

[Total: 1    Average: 5/5]

Python has an exponentiation operator (**) which can be used to calculate the power of a number. x**y returns x raised to y i.e. y times multiplication of x. Since we need to calculate square root, y should be (1/2)

>>> 10**(1/2) 3.1622776601683795 >>> 25**(1/2) 5.0

admin
Leave a Reply

Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages