首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试在线运行Python代码时出错

尝试在线运行Python代码时出错
EN

Stack Overflow用户
提问于 2014-04-22 20:55:35
回答 1查看 61关注 0票数 0

我已经在Powershell中运行了十几次代码,一切都很正常。它总是专注于我的raw_input()语句。谁能告诉我发生了什么,任何解决方案都将不胜感激。这只是一个介绍,所以没有数学,只是一些设定的故事。

代码语言:javascript
复制
def cell():
      print """
      "Welcome roomie!"
      You wake up to find yourself in a jail cell
      "You have been sleeping since the guards threw you in here.
      They must have hit you pretty hard, ha ha ha."
      You look around
      finally your eyes focus on the source of the voice
      across the room was a man
      he looked as if he was nothing but skin and bone.
      Then you noticed the scar... it ran down his arm
      It was an open wound,
      but wasn't bleeding just black.
      The man followed your eyes
      "Ah so you noticed, yes I am forsaken."
      1) Remain quit
      2) Ask about the forsaken
      3) Quickly check your body for scars
      4) Scream
      Please choose one:"""

      answer = raw_input("> ")

      if answer == "1":
          print '"You don\'t talk much"'
          cell_name()
      elif answer == "2": 
          print '"Not sure, all I know is if you have a scar like this"'
          print '"They throw you in jail."'
          cell_name()
      elif answer == "3":
          print '"Don\'t worry I already checked you."'
          cell_name()
      elif answer == "4":
          print '"Shut up! Jeez pansy."'
          cell_name()
      else:
          print "Pick one of the numbers"
          cell()

def cell_name():
        print "Well whats your name kid."

        name = raw_input("> ")

        print "Alright, nice to meet ya %r" % name
        print "Well my name is Esman."
        destroyed_cell()

def destroyed_cell():
        print """
        All of a sudden you hear a rumble...
        rumble...
        rumble...
        silence.
        "What do you suppose that wa..."
        Crash!
        Huge parts of the ceiling had fallen down
        one had nearly crushed you
        instead it had landed perfectly right next to you
        the force was enough to break through the floor
        you turn to check on Esman
        But a huge piece of the ceiling had landed on him
        1) Stare in bewilderment
        2) try and help him
        3) he's a dead man, leave him
        Please choose one:"""

        answer = raw_input("> ")

        if answer == "1":
            print "Hurry kid get out of here."
        elif answer == "2":
            print "It's no use you have to save yourself"
        elif answer == "3":
            print "Run!"
        else:
            print "Pick one of the numbers" 

cell()
EN

回答 1

Stack Overflow用户

发布于 2014-04-22 21:19:39

我在http://repl.it/languages/Python上试过你的代码,它可以工作

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23220277

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档