Python Programming Examples Tutorial Index

Python Number Programs

This Python example code demonstrates a basic Python program for finding the square root of positive numbers.



Program:

#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))

Program Output:

The square root of 16.000 is 4.000


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram