# Define a function that takes an argument n
def summation(n):
  # Initialize a variable to store the sum
  sum = 0
  # Use a for loop to iterate from 1 to n
  for i in range(1, n+1):
    # Check if i is an even number using modulo operator (%)
    if i % 2 == 0:
      # Add the square of i to the sum using power operator (**)
      sum = sum + (i**2)
  # Return the sum as the output
  return sum

# Ask the user to enter a number
x = int(input("Enter no: "))
# Call the function with x as argument and print the result
print("The summation of squares of even numbers from 1 to", x, "is", summation(x))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: