I have to include a function in my code and so I wrote the code below but I do not know how to add all the even numbers between the two numbers entered by the user. It prints the even numbers only, it does not add them.
def sum_of_two_no(num1, num2):
for evenno in range(num1, num2 + 1):
if evenno % 2 == 0:
print (evenno)
num1 = 0
num2 = 0
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number number: "))
sum_of_two_no(num1, num2)
For example: If the user entered 1 for the first number and 10 for the second number, the program displays the even numbers between 1 and 10, but it does not add them.