title: Summing large primes takes time! How do I make it more efficient?
body: <p>I'm trying to complete <a href="https://projecteuler.net/problem=10" rel="nofollow noreferrer">Project Euler's 10th problem</a>, but the code I currently have takes so much time it hasn't been able to complete.</p>
  
  <p>I've looked around but I haven't been able to find out how to make the code take a shorter time. </p>
  
  <p>This is the code I have:</p>
  
  <pre><code>def IsPrime(num):
      for i in range(2, num/2):
          if num % i == 0:
              prime = False
              return prime
      prime = True
      return prime
  
  def SumOfPrime(limit):
      primesum=2+3    #For some reason my prime finder doesn't allow numbers below 5
      for check in range(5,limit):
          prime=IsPrime(check)
          if prime == True:
              primesum += check
      return primesum^2
  
  print(SumOfPrime(2000000))
  </code></pre>
  
  <p>The correct answer should be <code>142913828922</code>, however, as previously mentioned I don't get an output entirely. Is there any way to make this code faster? </p>