title: Doing a multi-step date check for holidays/weekdays in Python
body: <p><strong>Scenario:</strong> I am trying to build a function for a date check. The inputs for the function are: year, month and a holiday list (just a list of days). The function will check if the input_date is in the holiday list, if it is, it will sum one day to the input_date. Next it will check which weekday that is: if a Saturday (sum 2), if a Sunday (sum 1).</p>
  
  <p><strong>Issue:</strong> My problem is that if I just create a couple of if clauses to check for these criteria, the new date after the weekend check might also be on the holiday list, so the process should be repeated until I find a weekday that is not on the holidays list.</p>
  
  <p><strong>Question:</strong> Is there a way to encompass these checks in a loop? </p>
  
  <p><strong>Code so far:</strong></p>
  
  <pre><code>def datecheck (input_year, input_month, holiday_list):      
      datetime.inputdate =  date(year, month, 1) 
  
          # this checks if inputdate is a holiday   
          if inputdate is in holiday_list: 
              inputdate == inputdate + datetime.timedelta(days=1)
  
          # next part guarantees inputdate is a weekday
          if inputdate.weekday() == 5: 
              inputdate == inputdate + datetime.timedelta(days=2)
          else if inputdate.weekday() == 6:
              inputdate == inputdate + datetime.timedelta(days=1)
  
          #check again for holiday?
  
          outputdate = inputdate
      return outputdate
  </code></pre>