【发布时间】:2020-04-21 07:56:32
【问题描述】:
当我在 pycharm 中运行以下代码时,它会一直执行到 ans = input("Do you want to play this game") 并且当我输入答案是时,它应该理想地执行下面的代码,但它会执行 print('Thank you玩了这么多,你得到了',得分,'问题正确')
print ("Welcome to the page?")
ans = input("Do you want to play this game? Yes/No")
score = 0
if ans.lower()=='yes':
ans=input("When was Bangalore made capital city of Karnataka?")
if ans.lower()=="1956":
score=+1
print("Correct + 1")
else:
print("In-correct")
ans=input("Who is the current Mayor of Bangalore?")
if ans.lower()=="M Goutham Kumar":
score=+1
print("Correct + 1")
else:
print("In-correct")
ans=input("What is the GDP of Bangalore?")
if ans.lower()=="$210 Billion":
score=+1
print("Correct + 1")
else:
print("In-correct")
ans = input("Who is called as father of Bangalore?")
if ans.lower() == "Kempegowda":
score = +1
print("Correct + 1")
else:
print("In-correct")
print('Thank you so much for playing, you got', score, 'questions correct')
【问题讨论】:
-
这对我有用!你能检查变量
ans吗? -
这行得通,我尝试将
Yes和yes作为输入。
标签: python pycharm python-3.6