I have this string and I want to calculate the sum, but it doesn't show the right answer, it prints 51.
sumAndAverage = "English = 78 Science = 83 Math = 68 History = 65"
def sum_digits_string(str1):
sum_digit = 0
for x in str1:
if x.isdigit():
z = int(x)
sum_digit = sum_digit + z
return sum_digit
print(sum_digits_string(sumAndAverage))