그래서 곱셈 게임을 만들려고했습니다. 그래서 그것은 다소 효과가 있습니다. 그러나 옳은 답을 넣었을 때, 틀린 대답을 넣었을 때뿐만 아니라 두 번 잘못되었습니다.파이썬 코드에 어떤 문제가 있습니까? (곱셈 프로그램)
import sys #imports sys
random1=['1','2','3','4','5','6','7','8','9','10','11','12'] #makes a list with numbers 1-12
random2=['1','2','3','4','5','6','7','8','9','10','11','12'] #makes another list with numbers 1-12
from random import choice #gets a random number
while True: #makes the following code run in a loop
print "To exit this game type 'exit'" #prints stuff
theyputinstuffhere = raw_input("What is " + choice(random2) + " times " + choice(random1) + "? ") #asks the user things like 1*5 or some other random stuff.
if theyputinstuffhere == "exit": #if the user typed in 'exit' then exit the game
print "Now exiting game!" #prints stuff
sys.exit() #exits
elif theyputinstuffhere == int(choice(random2))*int(choice(random1)): #if what i typed is right, print stuff (I think i messed up here!)
print "Correct!" #print stuff
else:
print "Wrong!" #otherwise print stuff
난 내가 잘못 HELP 무엇을했는지 모르는 !!!!!!!!!!!!! 빨리!!!!!!!!!!!!!!!!!
당신이'choice (random2)'와'choice (random1)'을 다시 부를 때 – stackErr
와우 .. .. – karthikr