Hello! I am following a tutorial in which I am required to type in and copy this haversine formula code. For some reason, I am unable to get it working even when I copied it completely? Am I missing something? I just do not understand what I have done wrong here. I am quite new to coding so I might have effed it up in some really weird way.
Here is the error:
Error
Python error: SyntaxError: ('invalid syntax', ('', 8, 30, ‘def haversine(coord1, coord2)\n’))
Here is my code:
Here is said video tutorial i am following: https://vimeo.com/369809944 [vimeo.com] at 4:11.
Any kind of help would be greatly appreciated!
Invalid syntax error - copied code but it does not work
1927 2 1- Andromonoid
- Member
- 5 posts
- Joined: Feb. 2020
- Offline
- alexwheezy
- Member
- 303 posts
- Joined: Jan. 2013
- Offline
- Andromonoid
- Member
- 5 posts
- Joined: Feb. 2020
- Offline
hou.alex.get
In python, after the function name and arguments in brackets, a colon always follows. Therefore, it will be rightdef haversine(coord1, coord2):
Thank you! Now it works and no errors! I got to look up coding a bit more so I don't stumble into beginner errors like this.
I appreciate the help!
-
- Quick Links