I've written a function, isprime(n), that returns True if a number is prime and false if not. I am able to loop the function a defined number of times; but I can't figure out how to iterate until it finds x number of primes. I feel as though I have a decent understanding of For and While loops, but am confused as to how one integrates boolean return values into loops. Here is my current code and error:
Error result:
input:100
Traceback (most recent call last):
File "euler7.py", line 25, in <module>
primeList += 1
TypeError: 'int' object is not iterable
And the code:
def isprime(n):
    x = 2
    while x < sqrt(n):
        if n % x == 0:
            return False
        else:
            x += 1
    return True
userinput = int(raw_input('input:'))
primeList = []
primesFound = 0
while primesFound != userinput:
    i = 2
    if isprime(i):
        primeList.append(i)
        primeList += 1
        i += 1
    else:
        i += 1
EDIT (including the updated and functioning code):
from math import sqrt
def isprime(n):
    x = 2
    while x < (sqrt(n) + 1):
        if n % x == 0:
            return False
        else:
            x += 1
    return True
userinput = int(raw_input('input:'))
primeList = []
primeList.append(2)
i = 2
while len(primeList) != userinput:
    if isprime(i):
        primeList.append(i)
        i += 1
    else:
        i += 1
print 'result:', primeList[-1]
 
     
     
     
     
     
     
    