title: Divisibility test algorithm
body: <p>Write a function called FooBar that takes input integer n and prints all the numbers from 1 upto n in a new line. If the number is divisible by 3 then print "Foo", if the number is divisible by 5 then print "Bar" and if the number is divisible by both 3 and 5, print "FooBar". Otherwise just print the number. </p>
  
  <pre><code>for example FooBar(15) should print as follows: 
  1 
  2 
  Foo 
  4 
  Bar 
  Foo 
  7 
  8 
  Foo 
  Bar 
  11 
  Foo 
  13 
  14 
  FooBar 
  </code></pre>
  
  <p>Its easy but the interview is checking for a better algorithm.</p>
  
  <p>The first thing came to my mind is:</p>
  
  <pre><code>for i in xrange(1,101): print [i,'Fizz','Buzz','FizzBuzz'][(i%3==0)+2*(i%5==0)]
  </code></pre>
  
  <p>Please suggest if you ve any other ways of solving it.</p>