zoukankan      html  css  js  c++  java
  • Python学习之easygui实现简单小游戏

    import random, easygui
    secret = random.randint(1, 99)
    guess = 0
    tries = 0
    easygui.msgbox("""Hi! I'm the Dread Pirate Roberts, and I have a secret!
    It is a number from 1 to 99. I'll give you 6 tries...""")
    while guess != secret and tries < 6:
    guess = easygui.integerbox("what's your guess?")
    if not guess: break
    if guess < secret:
    easygui.msgbox(str(guess) + "is too low!")
    elif guess > secret:
    easygui.msgbox(str(guess) + "is too high!")
    tries += 1
    if guess == secret:
    easygui.msgbox("Great! You got it! Found my secret, you did!")
    else:
    easygui.msgbox("No more guesses! The number was" + str(secret))

    来到这里的都是程序猿,所有资料自取~
  • 相关阅读:
    KMP总结
    条件概率的计算
    EL和JSTL
    tomcat部署web项目
    web
    面试1
    面试可能会问的题
    简介
    建一个springboot项目
    刷题之牛客网
  • 原文地址:https://www.cnblogs.com/ifan-he/p/9932894.html
Copyright © 2011-2022 走看看