贺卡/猜字游戏

print("""
        欢迎参加猜字游戏
    把字母组合到一起成为一个正确的单词.

      """)          

zqk = "y"
while zqk == "y" or zqk == "Y":     
    word = random.choice(WORDS) #从序列中随机挑出一个单词
    correct = word      #判断玩家是否猜对的变量
    jumble = ""         #创建乱序后的单词
    while word :            
        position = random.randrange(len(word))    #根据word长度,产生word的随机位置,randrange() 方法返回指定递增基数集合中的一个随机数
        jumble += word[position]                 
        word = word[:position] + word [(position + 1):]   
    print("\n\n乱序后单词:",jumble)   

    guess = input("请你猜:")
    while guess !=  correct and guess != "":     #!=表示不等于
        print("不好意思,不正确.")
        guess = input("加油,再试一次:")

    if guess == correct:
        print("prefect,你成功了!")
        zqk = input("再玩一次(Y/N):")

holiday = input("节日名称:")                   #input ()”函数是输入函数。
To_name = input("收件人:")
Fr_name = input("送件人:")
print("--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--")
print("--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--")
print("")   #print()可用来换行
print("")
print("     节        日        祝      福       ")         #标题
print()
print()
print(To_name+"")               #收件人姓名
print()
print()
print()
print("     祝您"+holiday+"快乐! ")           #正文
print()
print()
print("                                                      "+Fr_name)      #送件人姓名
print()
print()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值