-2

Image of my code: enter image description here

I'm new to pyton and i'm trying to raise the input of the variable x and y to the second power, but i don't know how to. Plz help, this is due on friday :'-(

0x5453
  • 12,753
  • 1
  • 32
  • 61
  • 1
    [Please do not upload images of code/data/errors when asking a question.](//meta.stackoverflow.com/q/285551) – 0x5453 Aug 09 '22 at 18:13
  • You even said this was homework. You cannot ask us to do your homework for you. That's unethical. Note that ANY beginning Python tutorial would cover this question, as did your instructor in class. `(x**+**y)` is C syntax, not Python. The syntax for returning the square of `x` is `x**2`. – Tim Roberts Aug 09 '22 at 18:14
  • `x**` by itself is invalid syntax. If you want x^2, you need to use `x**2`. Similarly, I'm guessing `**y` should be `y**2`. – 0x5453 Aug 09 '22 at 18:16
  • What are you actually trying to *do*? Compute the area of a rectangle? No exponentiation is required for that. – chepner Aug 09 '22 at 18:19

1 Answers1

0
x = float(input("The first side\'s length:"))
y = float(input("The second side\'s length:"))

z = x**2 + y**2 

I assume you want Z to be the sum of x squared and y squared. Regardless, the correct syntax for squaring is using **2