allPrimes printing out a empty tuple Python
<p>So I have this code and it is supposed to print out a tuple with all the prime numbers in it. But instead, it's just printing out a empty tuple... </p>

<blockquote>
  <p>Can anyone tell me why?
  I also MUST USE A TUPLE.</p>
</blockquote>

<pre><code>def isPrime(number):
 for i in range(2,int(number**(0.5))+1):
     if number % i == 0:
         return False
     else:
         return True


def allPrimes(number):
    tup=()
    for i in range(1,number):
        if isPrime(i) == True:
            tup += (i,)
    print(tup)

allPrimes(26)
</code></pre>

<blockquote>
  <p>Here is the correct code</p>
</blockquote>

<pre><code>def isPrime(number):
    if number &lt; 2:
       return False
    for i in range(2, int(number ** (0.5)) + 1):
        if number % i == 0:
            return False
    return True



def allPrimes(number):
    tup=()
    for i in range(1,number):
        if isPrime(i) == True:
            tup += (i,)
        print(tup)

allPrimes(26)
out[1]: (2, 3, 5, 7, 11, 13, 17, 19, 23)
</code></pre>

<p>It's because your isPrime function doesn't work.</p>

<p><code>number % 1</code>, i.e. 'remainder when divided by 1', will always be zero for integers.  </p>

python tuples primes