Im stuck.. can someone help, please?

Write a function called adding_squares that takes two inputs, x and y and returns the sum of the squares of each of those numbers. For example, if adding_squares(2, 3) is called, it should return the sum of 4 and 9 , which is 13 .

Try this:

def adding_squares(x, y):
  x = x ** 2
  y = y ** 2
  return x + y

print(adding_squares(2, 3)) # prints 13
1 Like

Oh thanks, yes of course. I am not thinking…

1 Like

Lol I am sorry for giving the solution :sweat_smile::sweat_smile:. These stupid situations happen to me sometimes when I don’t think well .

1 Like

I am surely will ask for another help again… if my brain is not working. :sweat_smile::grin:

1 Like

Think this out however. You won’t learn anything by blindly accepting a solution.

So okay, I need to create a function with 2 parameters:

def adding_squares(x,y):

How do we get the square of a number? By multiplying it by itself.

Then they want us to add the sum of those squares.

Break the instructions down so you can understand the task.

If you understand what they are asking you to do, you will be able to find (if possible) more efficient solutions.

def adding_squares(x,y):
    return x ** 2 + y ** 2

This is my take.

Thanks… im better with more thinking now before giving up. :blush: