livepython.net

160. Python Program to Find the Square Root Using the math Module

EasyImport

Overview

Your first program that imports a module from the standard library.

Problem Statement

Read a number (it may have decimals). Import the math module and print its square root with 2 decimal places. For example, for 16:

Square root: 4.00

A negative number has no real square root, and math.sqrt() would raise an error. For a negative number, print only:

No real square root

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One number. Example:

16

Output

The output for that example:

Square root: 4.00

The tests try 4 different inputs.

Learn this firstChapter 18 · Python Import: How to Use Modules
solution.py
# write your code here

EXPECTED OUTPUT

1Square root: 4.00

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.