【发布时间】:2019-01-11 04:00:22
【问题描述】:
if firplay == "HB gut":
import random
_1 = "Yay you scored a 97 yard touchdown. This scenario is over. YOU WIN"
_2 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_3 = "Your team commited a turnover. This scenario is over. YOU LOSE!"
_4 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_5 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_6 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_7 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_8 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_9 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
_10 = "You Gained 3 yards now it is 2nd and 7 from your own 16"
PossibleOutcomes = [_1,_2,_3,_4,_5,_6,_7,_8,_9,_10]
mychoice = random.choice(PossibleOutcomes)
print(mychoice)
if "Yay you scored a 97 yard touchdown. This scenario is over. YOU WIN" == mychoice:
print ("You would be an amazing head coach and luck will always be on your side")
elif "You Gained 3 yards now it is 2nd and 7 from your own 16" == mychoice:
_2play = input ("It's your ball on the Seattle 16. The defense is in cover 2. What play do you want to run? Bubble catch, Stop and go, or Hook and ladder?")
else:
print("You would be a horrible head coach your team will never make the playoffs and you will be fired.")
if _2play == "Bubble catch":
import random
【问题讨论】:
-
这里没有循环。如果您指的是
elif中的_2play = input...,那么它只会在这种情况下定义。如果mychoice是别的什么,在使用的时候不会定义,会抛出异常。顺便说一句 - 每次您想创建_1、_2... 之类的变量时,最好使用list之类的数据结构。 -
我们看不到 firplay 是在哪里定义的,它只在你的代码中出现过一次。
-
请考虑修改您在此问题中发布的代码示例。就目前而言,它的格式和范围使我们很难为您提供帮助;这是一个great resource,可以帮助您开始。 -1,不要走错路。否决票是我们在这里指出内容问题的方式;改进您的格式和代码示例,我(或有人会)很乐意将其还原。祝你的代码好运!
标签: python python-3.x