title: TypeError: argument of type 'int' is not iterable
body: <pre><code>#!/usr/bin/python 
  
  import time 
  from array import *
  
  THINKING  = 0
  HUNGRY = 1
  EATING = 2
  
  class Philosopher: 
      def __init__(self):
          self.ph = array('i',[1, 2, 3, 4, 5])
          self.sleeptime = array('i',[30, 30, 30, 30, 30])
  
      def initialization_code(self):
          for i in range(self.ph.__len__()):
              self.ph[i] = THINKING
  
      def pickup(self,i):
          self.ph[i] = HUNGRY 
          self.test(i)
          if(EATING not in (self.ph[i])):
              while(EATING not in (self.ph[i])):
                  time.sleep(self.sleeptime[i])
  
      def putdown(self,i):
          self.ph[i] = THINKING
          self.test((i+4)%5)
          self.test((i+1)%5)
  
      def test(self,i):
          if((2 not in (self.ph[(i+4)%5]))and(2 not in (self.ph[(i+1)%5]))and(self.ph[i]==HUNGRY)):
              self.ph[i] = EATING
  
      def start_process(self):
          for i in range(self.ph.__len__()):
              self.pickup(i)
              self.putdown(i)
  
  
      def display_status(self):
          for i in range(self.ph.__len__()):
              if (self.ph[i] == 0):
                  print "%d is THINKING" % i+1
              elif (self.ph[i] == 1):
                  print "%d is WAITING" % i+1
              elif (self.ph[i] == 2):
                  print "%d is EATING" % i+1
  
  phil = Philosopher()
  phil.initialization_code()
  phil.start_process()
  phil.display_status()   
  </code></pre>
  
  <p>The above is my piece of code in which i'm trying to implement dining philosopher problem in python.
  when i run this code it shows me this error:</p>
  
  <pre><code>Traceback (most recent call last):
  
  File "dining.py", line 59, in &lt;module&gt;
  
  phil.start_process()
  
     File "dining.py", line 43, in start_process    
     self.pickup(i)    
     File "dining.py", line 27, in pickup    
     self.test(i)    
     File "dining.py", line 38, in test    
     if((2 not in (self.ph[(i+4)%5]))and(2 not in (self.ph[(i+1)%5]))and(self.ph[i]==HUNGRY)):
     TypeError: argument of type 'int' is not iterable
  </code></pre>
  
  <p>Can anyone please help me at this, why is it showing this error. I searched about it but couldn't resolve.
     Thanks in advance!!</p>