title: .index() function in python not working
body: <p>I'm completing a school assignment in python where a user must enter a date in the format dd/mm/yyyy and i have to split each part (dd, mm, yyyy) and store them in a list. </p>
  
  <pre><code>date = input("Enter a date in the following format 'dd/mm/yyyy: "); 
  date = date+'/'
  
      def split(date):
          dates = []
          i = 0
          while i &lt; len(date):
              x = date.index('/', i)
              dates.append(date[i:x])
              i = x
          return dates
  </code></pre>
  
  <p>This is the code i used. I'm searching for the character '/' in my string 'date' and then extracting a substring from date which I am appending to the list dates. </p>
  
  <p>Apparently my .index() function isnt working as I hoped it would. Is it because I cant pass a variable as an argument for the index function? Or is there some other problem.</p>
  
  <p>I know the index() function is the problem because when I print the value of x just after the iteration, the value of x doesn't get updated. </p>
  
  <p>This is the output i get after troubleshooting <br>
      i=0 x=2 dates = ['12'] <br>
      i=2 x=2 dates = ['12','']</p>
  
  <p>and it continues into an infinite loop</p>
  
  <p>Any help on this matter would be appreciated :')</p>