猫史档案馆


【Python作品分享】幽灵游戏【作品秀】

用户:瓜木瓜木查看:0 回复:0 评论:0 创建时间:2020-11-26T17:09:59


【作品展示】

center_image

 

【作品介绍】

1

 

【作品源代码】

import random
from random import randint


# Ghost Game
print('Ghost Game')
feeling_brave = True
score = 0
while feeling_brave:
    ghost_door = random.randint(1, 3)
    print('Three doors ahead...')
    print('A ghost behind one.')
    print('Which door do your open?')
    door = input('1,2,or 3')
    door_num = int(door)
    if (door_num == ghost_door):
        print('GHOST!')
        feeling_brave = False
    else:
        print('No ghost!')
        print('You enter the next room.')
        score = (score + 1)
print('Run away!')
print('Game over!You scored', score)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页