This Python example code demonstrates a basic Python program for finding the square root of positive numbers.
#Variable definition and assignment num = 16 #Remove comments from the bottom lines to take input from the user #num = float(input('Enter a number: ')) #Calculation to find square root sroot = num ** 0.5 # Print the output print('The square root of %0.3f is %0.3f'%(num ,sroot))
The square root of 16.000 is 4.000
Found This Useful? Share This Page!