Python:当我不想要时打印出列表

时间:2017-11-24 17:30:39

标签: python

我制作了一个功能列表,想要随机选择一个用于琐事游戏,它会不断打印出我列表中的功能。(我已经定义了功能)

def NBAquestions():     x = 0     问题6 =问题(“NBA代表什么?”,“全国篮球直播”,“国家有趣的生活”,“全国篮球联赛”,                          “Nothin But Liberals”,3)     if question6.ask()== True:         打印(“你是对的”)         x + = 1     其他:         打印(“不正确”)         x - = 1

question7 = Question("What team won the championship last year (2016)?", "Golden State Warriors", "Miami Heat", "Minnesota Wild",
                     "Clevland Caviliers", 1)
if question7.ask() == True:
    print("You are correct")
    x += 1
else:
    print("incorrect")
    x -= 1

question8 = Question("What doesn't belong?", "Stephen Curry", "Kevin Durant", "Draymond Green",
                     "Mitch Marner", 4)
if question8.ask() == True:
    print("You are correct")
    x += 1
else:
    print("incorrect")
    x -= 1

question9 = Question("Is the Seattle Supersonics a current NBA team", "True", "False", "-",
                     "-", 2)
if question9.ask() == True:
    print("You are correct")
    x += 1
else:
    print("incorrect")
    x -= 1

question10 = Question("Micheal who?", "Jackson", "Johnson", "Jordan",
                     "Jarret", 3)
if question10.ask() == True:
    print("You are correct")
    x += 1
else:
    print("incorrect")
    x -= 1


print('Welcome to the Sports Trivia Game, you will compete head to head in a tivia matchup. One point will be awarded for getting 1 question right, but if you get 1 wrong you will lose a point')
a = input("please enter player 1's name: ")
b = input("please enter player 2's name: ")


questionList = ([NBAquestions(), MLBquestions(), NHLquestions(), NFLquestions()]

0 个答案:

没有答案
相关问题