I need a python code to find square root?
Answers
Answered by
3
Answer:
How to Find Square Root in Python
- Using Exponent. number = int(input("enter a number: ")) sqrt = number ** 0.5 print("square root:", sqrt) ...
- Using math.sqrt() Method. import math number = int(input("enter a number:")) sqrt = math.sqrt(number) print("square root:" , sqrt) ...
- Using math.pow() Method.
Answered by
3
Explanation:
Using Exponent
number = int(input("enter a number: "))
sqrt = number ** 0.5
print("square root:", sqrt)
Output:
enter a number: 64
square root: 8.0
Using math.sqrt() Method
import math
number = int(input("enter a number:"))
sqrt = math.sqrt(number)
print("square root:" , sqrt)
Using math.pow() Method
import math
number = int(input("enter a number:"))
sqrt = math.pow(number, 0.5)
print("square root: ", sqrt)
Similar questions