title: How to change value inside function
body: <p>Very new to coding. I'm trying to learn myself Python by doing a little project I came up with. I realize this will be a slow process, but I just had a question about loops.</p>
  
  <p>This is what I'm trying to do:</p>
  
  <p>-The user inputs a list of numbers, and if a number in the list is more than 360, the function will subtract 360 from it until it is below 360.</p>
  
  <p>-Once it's below 360:</p>
  
  <ul>
  <li>If it's above 270, it will subtract the number from 360.</li>
  <li>If it's above 180, it will subtract 180 from the number.</li>
  <li>If it's above 90, it will subtract the number from 180.</li>
  </ul>
  
  <p>-It should then print the values. If this process sounds familiar, I'm trying to convert an azimuth to a bearing. Right now I'm just focused on getting the numerical value, then I'll add the direction.</p>
  
  <p>This is my code:</p>
  
  <pre><code>    def bearing(x):
          for i in range(len(x)):
              while x[i]&gt;=360:
                  x[i]-=360
              if x[i]&gt;270:
                  x[i]==360-x[i]
              elif x[i]&gt;180:
                  x[i]-=180
              elif x[i]&gt;90:
                  x[i]==180-x[i]
          print (x)
  </code></pre>
  
  <p>The while loop works fine, but it stops there. I'm not sure if my indenting is wrong, or I'm using the wrong commands, but any help would be greatly appreciated.</p>