第二个函数中的else语句不起作用

时间:2018-03-17 15:55:13

标签: python

import os  
import sys    
import random     
import winsound

def question():

print("1.) What is currently the most popular MOBA?")
print("A.) League of Legends")
print("B.) Smite")
print("C.) Dota 2")
print("D.) Call of Duty")
answer = input()
if answer == "A" or answer == "a":
    print("Correct")
    winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
else :
    print("Incorrect")
    winsound.PlaySound("SystemHand", winsound.SND_ALIAS)
question()

def question2():

print("2.) Which of the following is a 100 player royal game?")
print("A.) Call of Duty")
print("B.) Fortnite")
print("C.) CSGO")
print("D.) Dota 2")
answer1 = input()
if answer1 == "B" or "b":
    print("Correct")
    winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
else:
    print("Incorrect")
    winsound.PlaySound("SystemHand", winsound.SND_ALIAS)

问题2()

1 个答案:

答案 0 :(得分:0)

纠正这一行

if answer1 == "B" or "b":

if answer1 == "B" or answer1 ==  "b":