Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 8, 2024
1 parent b765580 commit d9d85fe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions book/python/04_string_operations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,16 @@
"source": [
"# coordinate_string = \"27.9881N, 86.9250E\" # Chomolungma\n",
"coordinate_string = \"63.0692N, 151.0121W\" # Denali\n",
"(lat_num, lat_dir), (lon_num, lon_dir) = [(s[:-1], s[-1]) for s in coordinate_string.split(\", \")]\n",
"(lat_num, lat_dir), (lon_num, lon_dir) = [\n",
" (s[:-1], s[-1]) for s in coordinate_string.split(\", \")\n",
"]\n",
"\n",
"latitude = float('-' + lat_num if lat_dir == 'S' else lat_num) # Convert string to float and convert S to -\n",
"longitude = float('-' + lon_num if lon_dir == 'W' else lon_num) # Convert string to float and convert W to -\n",
"latitude = float(\n",
" \"-\" + lat_num if lat_dir == \"S\" else lat_num\n",
") # Convert string to float and convert S to -\n",
"longitude = float(\n",
" \"-\" + lon_num if lon_dir == \"W\" else lon_num\n",
") # Convert string to float and convert W to -\n",
"\n",
"print(f\"Parsed coordinates: ({latitude}, {longitude})\")"
]
Expand Down

0 comments on commit d9d85fe

Please sign in to comment.