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

    来到这里的都是程序猿,所有资料自取~
  • 相关阅读:
    1276
    1235
    1170
    Grids
    1137
    1127
    1076
    🍖Mysql三种模式的指定方式介绍
    🍖存储引擎介绍
    🍖MySQL库的详细操作
  • 原文地址:https://www.cnblogs.com/ifan-he/p/9932894.html
Copyright © 2011-2022 走看看