title: Comparing the values within a specified range
body: <p>I am working on a program in python and need to compare that two values to see if they are within the 10% range of each other. I am not getting what code I can implement to handle this.</p>
  
  <p>For example, for one item the value of <strong>fat</strong> is <em>100</em> and for the other it is <em>110</em>. Now I want to check whether both of the values are within the 10% range of each other and if this condition is met I have to print something (I can do it). I just want to know what to write in the if condition of the program.</p>
  
  <p>EDIT: This is what I have currently</p>
  
  <pre><code>if button_id == 'middle':
        if mydict['cholesterol'] &lt;= 0.10*mydict1['cholesterol']:
            tkinter.messagebox.showinfo('Correct', 'You got it right')
        else:
            tkinter.messagebox.showinfo('Wrong', 'You got it wrong')
  </code></pre>
  
  <p>I am stuck in the second IF condition, where I have to check whether the values are within the 10% range of each other.</p>