Ex21 How do I return a**2 + b**2?

This is my fourth day coding. I’ve never coded before, or used Atom or PowerShell before.

I wanted to add a function ‘squared’, but it doesn’t print when I try to run this in PowerShell. Here’s what I put on the editor:
def squared(a, b):
print(f"FINDING {a}2 + {b}2")
return (a
2) + (b
2)

Assuming you are calling the actual function in the file (and just didn’t include it here), it’s probably because you are returning the value of the addition in the function, not printing it to the console.

Try:

print(squared(3,6))

This will print the returned output of the function.

Keep up the good work :+1:

A free service run by Zed A. Shaw for learncodethehardway.org.