The following code shows how to Find the Sum of All Prime numbers in a Range in Python.

# Find sum of all prime numbers in given range 
def findPrime(p):
  t=int(p/2)
  for s in range(2, t+1):
    if p%s == 0:
      return 0;
  return 1


def findSum(a, b):
  a=int(a)
  b=int(b)
  print("Prime Numbers...")
  sum=0
  for i in range(a, b+1):
    x=findPrime(i)
    if x==1:
      sum=sum+i
      print(str(i)+"  ")
  print("Sum of all prime numbers in the range["+str(a)+", "+str(b)+"] is "+str(sum))


x=input("Enter the lower limit of the range: ")
y=input("Enter the upper limit of the range: ")
findSum(x,y)

Output

The Result Produced by the Program to Find the Sum of All Prime numbers in a Range in Python
The Result Produced by the Program to Find the Sum of All Prime numbers in a Range in Python

Further Reading

Python Practice Exercise

Deep Learning Methods for Object Detection

Examples of OpenCV Library in Python

Examples of Tuples in Python

Python List Practice Exercise

programmingempire