Returned type should be int not float
Closed this issue · 1 comments
GreatBahram commented
Hello there,
I think, you should modify the type hints, since the xdist and ydist are both integer, so sum of them is going to be integer too, right?
ClassicComputerScienceProblemsInPython/Chapter2/maze.py
Lines 100 to 105 in 57d5f94
davecom commented
Probably; we return float because we want consistency with Euclidean distance, and so that the type hints match with the heuristic parameter of astar(). The alternative is a float() conversion at the end of distance().
Thanks for pointing this out.