python - Program stuck in while loop not printing -
import random def usertype(): randletter = random.choice('qwer') userinput = raw_input('press '+str(randletter)) if userinput == randletter: return 'correct' else: return 'incorrect' def usertypetest(x,y,result): while x <= 9: result = usertype() if result == 'correct': x = x+1 y = y+5 else: x = x+1 y = y-2 return str(y)+'is score' print usertypetest(0,0,usertype) here code. want ask user press button, randomly chosen set (q, w, e, r), print either correct or incorrect, depending on button press. want happen 10 times. after ten tries print score: 5 each 'correct' , -2 'incorrect'. instead receive this. press e(e) press e(e) press w(e) press q(e) press q(e) press q(e) press r(e) press e(e) press w(e) press q(e) press e(e) press e(e) press e(e) press e(e) press q(e) press w(e) press r(e) press w(e) press r(e) press w(e) pres