贺卡/猜字游戏

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()

你可能感兴趣的:(servlet,服务器)