Comment

Anonymous

Oh my Lordy! I started decoding this for you but seriously gave up. Such flow bad, such syntax no good

Parent comment

Moe

Hi hows it going? im trying to open a note pad file using python, the commands i use , load the program but when i choose which ever questionare it doesnt load it can u please let me know the problem? because i got a mid term in 5 days thnx alot the code is the following: def IQ(): x=0 while x!=10: score =0 myfile= open('IQ.txt', 'r') question = myfile.readline() answer1 = myfile.readline() answer2 = myfile.readline() answer3 = myfile.readline() answer4 = myfile.readline() correct = myfile.readline() explanation = myfile.readline() points=float(myfile.readline()) print question print "1-"+ answer1 print "2-"+ answer2 print "3-"+ answer3 print "4-"+ answer4 answer=raw_input("what's your answer?") answer=answer.rstrip() x=x+1 if answer== correct[0]: print"\nRight", score+=points else: print"\nWrong", print explanation print "score:",score,"\n\n" def Random(): x=0 while x!=10: score =0 myfile= open('Random.txt', 'r') question = myfile.readline() answer1 = myfile.readline() answer2 = myfile.readline() answer3 = myfile.readline() answer4 = myfile.readline() correct = myfile.readline() explanation = myfile.readline() points=float(myfile.readline()) print question print "1-"+ answer1 print "2-"+ answer2 print "3-"+ answer3 print "4-"+ answer4 answer=raw_input("what's your answer?") answer=answer.rstrip() x=x+1 if answer== correct[0]: print"\nRight", score+=points else: print"\nWrong", print explanation print "score:",score,"\n\n" total=0 while total==0: print "1- IQ" print "2- Random" choice=(raw_input("which game you wana play:")) try: choice=int(choice) if choice==1: IQ() total=total+1 if choice==2: Random() total=total+1 else: print"you should enter either 1 or 2" total=0 except: print "you should enter a number" total=0