bz_2020
bz_2020

Reputation: 79

Printing issue when using GeoPy

I am completely new to Python so I appreciate that I maybe making a basic mistake somewhere. When I do the below, I get a "SyntaxError: invalid syntax" error after the print line. What am I doing wrong?

import geopy.distance

coords_1 = (52.2296756, 21.0122287)
coords_2 = (52.406374, 16.9251681)

print geopy.distance.distance(coords_1, coords_2).km

Upvotes: 1

Views: 164

Answers (1)

10 Rep
10 Rep

Reputation: 2270

You are typing python 2 code in python 3. You need to have parentheses on the print statement.

Code:

import geopy.distance

coords_1 = (52.2296756, 21.0122287)
coords_2 = (52.406374, 16.9251681)

print(geopy.distance.distance(coords_1, coords_2).km)

Hope this helps!

Upvotes: 2

Related Questions