练习 35 分支和函数

    ex35.py

    练习 35 会话

    1. You are in a dark room.
    2. There is a door to your right and left. Which one do you take?
    3. There is a bear here.
    4. The bear has a bunch of honey.
    5. The fat bear is in front of another door. How are you going to move the bear?
    6. > taunt bear
    7. > open door
    8. > 1000
    9. You greedy bastard! Good job!
    • 画一个这个游戏的流程图,并指出它是如何运转的。
    • 修正你的错误,包括拼写和语法错误。
    • 为你不理解的函数写上注释。
    • 为游戏增加一些功能,同时使代码更加简化。

    为什么你要用 while True 这样可以构建一个无限循环。

    为什么 input() 有时会被写成 input('> ') input 的参数是一个字符串,所以要在获取用户输入的内容前面加一个提示符。(ai酱注:这里 > 也可以换成想要提示用户的文字。)