title: Trying to remove specific values from a list in Python
body: <pre class="lang-py prettyprint-override"><code>    FCF_margin2017 = 3.3
      FCF_margin2018 = 1.5
      FCF_margin2019 = 2.3
      FCF_margin2020 = 30
      
      fcf_margin_list = FCF_margin2017, FCF_margin2018, FCF_margin2019, FCF_margin2020
      
      
      sorted_fcf_margin_list = sorted(fcf_margin_list)
      
      value1 = sorted_fcf_margin_list[0]
      value2 = sorted_fcf_margin_list[1]
      value3 = sorted_fcf_margin_list[2]
      value4 = sorted_fcf_margin_list[3]
      
      value_list = value1, value2, value3, value4
      median_list = value2, value3
      
      median = sum(median_list)/2
      mean = sum(value_list)/2
      
      upper = median+mean 
      lower = median-mean
      
      def CheckForLess(fcf_margin_list, val): 
      
        for x in fcf_margin_list:
         if val &lt;= lower: 
      
          if (CheckForLess(fcf_margin, val)): fcf_margin_list.remove()
      
          for x in fcf_margin_list:
           if val &gt;= upper: 
            if (CheckForLess(fcf_margin, val)): fcf_margin_list.remove()
  
  
      fcf_margin_list 
  </code></pre>
  <p>This code currently returns:</p>
  <pre><code>(3.3, 1.5, 2.3, 30)
  </code></pre>
  <p>This is same as the original list, when I was trying to remove values in the list greater than upper and less than lower. How can I go about removing values from the list <code>fcf_margin_list</code> given that they meet my specified requirements?</p>