human
Count of primes in a given range that can be expressed as sum of perfect squares | Function to check if a prime number satisfies the condition to be expressed as sum of two perfect squares.
Function to check if a number is prime or not.
Corner cases.
Function to return the count of primes in the range which can be expressed as the sum of two squares.
If i is a prime.
If i can be expressed as the sum of two squares.
Return the count.
Driver code"
How can the above be solved in Python?

Write me a code to count of primes in a given range that can be expressed as sum of perfect squares and the other steps required?
assistant
#Here is code to count of primes in a given range that can be expressed as sum of perfect squares and the other steps required.
 def sumsquare ( p ) :
	return ( p - 1 ) % 4 == 0
def isprime ( n ) :
	if n <= 1 :
		return False
	if n <= 3 :
		return True
	if ( n % 2 == 0 ) or ( n % 3 == 0 ) :
		return False
	i = 5
	while ( i * i <= n ) :
		if ( ( n % i == 0 ) or ( n % ( i + 2 ) == 0 ) ) :
		return False
		i += 6
	return True
def countOfPrimes ( L , R ) :
	count = 0
	for i in range ( L , R + 1 ) :
		if ( isprime ( i ) ) :
		if sumsquare ( i ) :
			count += 1
	return count
if __name__ == ' _ _ main _ _ ' :
	L = 5
	R = 41
	print ( countOfPrimes ( L , R ) )