Python测验游戏

时间:2016-03-07 19:03:54

标签: python-2.7

大家好,我是编程新手,我想对我想创建的程序提出疑问。这是一个简单的程序,我只是想让这个东西工作,我不能:P。我认为你很容易理解,所以我不会解释更多,所以这里是代码:

print "Quiz game"

counter = 0

print "1) 2 + 2?"

print "A. 3"
print "B. 4"
print "C. 6"
print "D. 8"

x = raw_input("Answer: ")
if x == "b" or x == "B":
    x = "correct"

print "2) 3 + 2?"

print "A. 3"
print "B. 6"
print "C. 9"
print "D. 5"

x = raw_input("Answer: ")
if x == "d" or x == "D":
    x = "correct"

print "3) 5 + 4?)"

print "A. 4"
print "B. 5"
print "C. 6"
print "D. 9"

x = raw_input("Answer: ")
if x == "d" or x == "D":
    x = "correct"

while x == "correct":
    counter = counter + 1
    if counter >= 1:
        print "Your score is good"
        x = raw_input("Press enter to quit")        
    else:
        print "Your score is not good"

1 个答案:

答案 0 :(得分:0)

好吧,它正在运行! :)谢谢你的时间

    print "Quiz game"

counter = 0

print "1) Poso kanei 2 + 2?"

print "A. 3"
print "B. 4"
print "C. 6"
print "D. 8"

x = raw_input("Apantish: ")
if x == "b" or x == "B":
    counter += 1

print "2) Poso kanei 3 + 2?"

print "A. 3"
print "B. 6"
print "C. 9"
print "D. 5"

x = raw_input("Apantish: ")
if x == "d" or x == "D":
    counter += 1

print "3) Poso kanei 5 + 4?)"

print "A. 4"
print "B. 5"
print "C. 6"
print "D. 9"

x = raw_input("Apantish: ")
if x == "d" or x == "D":
    counter += 1

while counter >= 1:
        print "Your score is good"
        x = raw_input("Press enter to quit")
        break;
else:
        print "Your score is not good"