Issue with math.sqrt not working

Hello, @laglassman, and welcome to Python Software Foundation Discourse!

We hope you enjoy the discussions here, and your Python class as well.

You may be interested in looking at the following pages, which provide helpful information about this forum:

When you post Python code here, it is important to format it properly for display purposes. Note that the indentation of the code in your initial post and some of the operators that are part it are not properly displayed. To format Python code, copy it and paste it between two lines of backticks, which are sometimes referred to as fences, as follows:

```
def hypotenuse(a1,b1):
    ha = a1**2
    hb = b1**2
    hsquared = a1**2 + b1**2
    result = math.sqrt(hsquared)
    return result
```

When your hypotenuse function is formatted with fences as above, it appears as follows on the page that is posted:

def hypotenuse(a1,b1):
    ha = a1**2
    hb = b1**2
    hsquared = a1**2 + b1**2
    result = math.sqrt(hsquared)
    return result

You would, of course, place the entirety of the code you are posting between fences.

@rob42 mentioned the math module that you will need to import in order for the following statement within your code to execute properly:

    result = math.sqrt(hsquared)

For that statement to execute as you have written it, place this at the beginning of your code:

import math
1 Like