11

I need help with this error message! !

 2 years ago
source link: https://www.codeproject.com/Questions/5331172/I-need-help-with-this-error-message
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

See more:

I'm new to coding and I'm trying to do this challenge in my schoolwork and it keeps giving me this error message.

Copy Code
this is the instructions for the challenge:

Assign point_dist with the distance between point (x1, y1) and point (x2, y2). The calculation is: Distance = SquareRootOf( (x2 - x1)2 + (y2 - y1)2 ).



heres my coding:

Python
Copy Code
import math

point_dist = 0.0

x1 = float(input())
y1 = float(input())
x2 = float(input())
y2 = float(input())

point_dist = math.sqrt((math.pow(x2 - x1), 2.0) + (math.pow(y2 - y1), 2.0))

print('Points distance:', point_dist)



and this is the error message:

Copy Code
Exited with return code 1.
Traceback (most recent call last):
  File "main.py", line 10, in <module>
    point_dist = math.sqrt((math.pow(x2 - x1), 2.0) + (math.pow(y2 - y1), 2.0))
TypeError: pow expected 2 arguments, got 1




what am I doing wrong??

What I have tried:

ive tried rewriting the code with everypossible symbol for power but im so lost now anyhelp will be greatly appreciated.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK