sublimetext2 - Python: Program unexpectedly terminates -
i used sublime text 2 , ran program in terminal. here code:
print("welcome quizwow!") while true: question = input("enter number of questions ask (up 10): ") ###program terminates after input: 'question' answered user. if question == '1': qonea = input("enter question here: ") qoneaa = input("enter answer here: ") print ("1: ", qonea) qoneaguess = input("enter guess here: ") if qoneaguess == qoneaa: print ("correct") else: print ("incorrect")
input() tries execute user entered python code. according docs:
this function not catch user errors. if input not syntactically valid, syntaxerror raised. other exceptions may raised if there error during evaluation.
so it's raising exception , terminates program.
i think want use raw_input() instead.
Comments
Post a Comment