title: Calculate the difference between two compass headings Python
body: <p>I have to test whether the difference in degrees between a compass reading and a set point is within x amount.</p>
  
  <p><a href="https://stackoverflow.com/questions/5024375/getting-the-difference-between-two-headings">This post</a> describes what I'm after, it's just in C# and I can't interpret how the solution would work.</p>
  
  <p>E.g...</p>
  
  <pre><code>Compass Reading  Set Point  Difference (absolute)
  360              1          1
  50               60         10
  1                360        1
  </code></pre>