Sound effect only happens on else statement

Hi,

I’m really new to Blender and i have run into a problem that even my teacher could’t fix.

We are trying to make a game where you need to solve basic math problems for children. when you enter your answer for some reason the sound effect (that is used when a ball touches a brick that has the math problem) only happens when you get the answer wrong (so on the else statement).

The code that i’m using now is as follows:

import bge
import bpy

def main():

cont = bge.logic.getCurrentController()
own = cont.owner

txt_object= bge.logic.getCurrentScene().objects['p1_text1']
answer_object = bge.logic.getCurrentScene().objects['answer_entry_p1']

answerToSum = int(txt_object["Answer"])
givenAnswer = answer_object['Text']

killSelf = cont.actuators['kill_self']
sp1 = cont.actuators['spawn1']
sp2 = cont.actuators['spawn2']
sp3 = cont.actuators['spawn3']
sp4 = cont.actuators['spawn4']
sp5 = cont.actuators['spawn5']

actuators = [killSelf, sp1, sp2, sp3, sp4, sp5]

#reset answer input field
answer_object['Text'] = ''

#actu = cont.actuators['myActuator']

sound = cont.actuators["sound"]

try:
    givenAnswer = int(givenAnswer)

except(ValueError):
    txt_object.text = "TOO BAD!"

finally:
    if (givenAnswer == answerToSum and not txt_object.text == 'NO!'):
        #txt_object.text = 'WELL DONE'


        for act in actuators:
           cont.activate(act)

        txt_object.text = ''
        cont.activate(sound)     

    else:
        txt_object.text = "NO!"
        cont.activate(sound)

main()

Thanks in advance!
[TABLE=“width: 500”]

[/TABLE]

You should wrap your code in

 tags. Spacing is important in Python, and without them it is not preserved, losing imprtant info about your code.