首页 > 编程语言 >【笨方法学python】ex31 - 作出决定

【笨方法学python】ex31 - 作出决定

时间:2022-10-08 07:33:04浏览次数:56  
标签:Good door python bear 巨熊 job ex31 print 方法学

代码如下:

点击查看代码
# coding=utf-8

print "You enter a dark room with two doors. Do you go through door #1 or door #2?"
# 你将进入一个有两扇门的黑暗房间。你是从 1 号门还是 2 号门进去的?

door = raw_input(">")

if door == "1":  # 选择 1 号门
    print "There's a giant bear here eating a cheese cake. What do you do?"  # 这里有一只巨熊正在吃奶酪蛋糕。你要做什么?
    print "1. Take the cake."  # 拿起蛋糕
    print "2. Scream at the bear."  # 冲着巨熊尖叫

    bear = raw_input(">")

    if bear == "1":  # 选择拿起蛋糕
        print "The bear eats your face off. Good job!"  # 巨熊吃掉你的脸,干得漂亮!
    elif bear == "2":  # 冲着巨熊尖叫
        print "The bear eats your legs off. Good job!"  # 巨熊吃掉你的腿,干得漂亮!
    else:  # 其他选项
        print "Well, doing %s is probably better. Bear runs away." % bear  # 好的,执行其他选项是更好的,巨熊跑开了

elif door == "2":  # 选择 2 号门
    print "You stare into the endless abyss at Cthulhu‘s retina."  # 你凝视着无尽的深渊
    print "1. Blueberries."
    print "2. Yello jacket clothespins."
    print "3. Understanding revolvers yelling melodies."

    insanity = raw_input(">")

    if insanity == "1" or insanity == "2":
        print "Your body survives powered by a mind of jello. Good job!"
    else:
        print "The insanity rots your eyes into a pool of muck. Good job!"

else:
    print "You stumble around and fall on a knife and die. Good job!"

执行结果:
image

标签:Good,door,python,bear,巨熊,job,ex31,print,方法学
From: https://www.cnblogs.com/TiramisuPS/p/16767829.html

相关文章