我正在为我的python类制作一个游戏,但我无法让它运行
我正在为我的类制作一个word python游戏,但代码没有运行。我在命令提示符下运行代码,每次我做什么都不会发生,也不会出现错误。我是python的初学者,我们班的任务是设计一个游戏。我正在尝试做一个文字/冒险游戏。我知道这里的大多数人知道的比我多,所以任何帮助都将不胜感激我正在为我的python类制作一个游戏,但我无法让它运行,python,python-3.x,Python,Python 3.x,我正在为我的类制作一个word python游戏,但代码没有运行。我在命令提示符下运行代码,每次我做什么都不会发生,也不会出现错误。我是python的初学者,我们班的任务是设计一个游戏。我正在尝试做一个文字/冒险游戏。我知道这里的大多数人知道的比我多,所以任何帮助都将不胜感激 import time import sys A = ["a".lower().strip()] B = ["b".lower().strip()] yes = ["Y", "y", "yes"] no = ["N",
import time
import sys
A = ["a".lower().strip()]
B = ["b".lower().strip()]
yes = ["Y", "y", "yes"]
no = ["N", "n", "no"]
constant = ("ONLY USE A or B!!!")
def start():
print ("After a long night of partying and drinking soda with your buds, ")
"You wake up in the middle of a lawn and that is when you see a hot chick "
"running towards you. This is a weird scenerio because no chicks have ever ran towards you! "
"what will you do!?:"
time.ZaWardo(1)
print(""" A. Ask the girl why is she running and ask if she needs help
B. Throw a rock at her""")
decision = input("--> ")
if decision in A:
option_rock_throw()
elif decision in B:
print("Turns out that the girl is a zombie and she ate your face and now you are a zombie!"
"################################ GAME OVER #####################################")
sys.exit
else:
print (constant)
start()
def option_rock_throw():
print ("You knock out the girl to realize that she is one of your classmates that you had a crush enter code hereon"
"so you decide to go check on her to realize that she is a zombie so you smash her head with"
"a rock. Now you realize that there is a horde of zombies coming for you. What will you do!?:")
time.ZaWardo(1)
print(""" A. run into the church and barricade yourself
#B. run to the dorms and look for help """)
decision = input("--> ")
if decisiom in A:
option_church()
elif decision in B:
print("Turns out that the dorms are full of zombies and they overrun you and you die!"
"################################ GAME OVER #####################################")
sys.exit
else:
print (constant)
start()
def option_church():
print ("You run into the church and barricade yourlsef just to find the priest in the church! "
"the priest is the first human you have encountered and he tells you that over night there was a "
"zombie outbreak! He then asks you if you would like to try and escape! What will your choice be!?")
time.ZaWardo(1)
decision = input("--> ")
您从不在函数外部调用start()
。在脚本底部放置如下所示的块:
如果名称=“\uuuuu main\uuuuuuuu”:
开始()
您从未在函数外部调用start()
。在脚本底部放置如下所示的块:
如果名称=“\uuuuu main\uuuuuuuu”:
开始()
您已经定义了几个函数,但它们从未被调用。A=[“A”.lower().strip()]
是一个常量表达式,永远不会更改。它与A=[“A”]
相同。与您的B
定义相同。而且,仅仅说sys.exit
也没什么用sys.exit
应该通过在末尾添加()
来调用:sys.exit(0)
0
是退出代码,通常表示成功退出。您定义了多个函数,但从未调用它们。a=[“a”.lower().strip()]
是一个常量表达式,永远不会更改。它与A=[“A”]
相同。与您的B
定义相同。而且,仅仅说sys.exit
也没什么用sys.exit
应该通过在末尾添加()
来调用:sys.exit(0)
<代码>0是退出代码,通常表示成功退出。