Python GUI guessing number game

Source: Internet
Author: User

# -*- coding:utf-8 -*-import easygui,randomstatus = easygui.buttonbox ("This is a guessing number game , click Start Game, click Exit to close the game. ",  choices = [" Start "," Exit "]) if status == " Start ":     s_number  = random.randint (1,100)     count = 0    u_number  = 0     #print  s_number    while count <  6 and u_number != s_number:        u_number  = int (Easygui.enterbox ("Please enter a 1-100 number:"))         if u_ number == s_number:             Easygui.msgbox ("Congratulations on your guess right")             break         elif u_number < s_number:       &Nbsp;     easygui.msgbox ("small")               #print  u_number        else:             easygui.msgbox ("Big Up")               #print  u_number        count  = count + 1    else:         Easygui.msgbox ("Six times you haven't guessed")          #print  s_numberelse:     easygui.msgbox ("Quit the game! ")      #print  " Exit "

This article is from the "Romantic Laugh" blog, make sure to keep this source http://lmdtx.blog.51cto.com/6942028/1610849

Python GUI guessing number game

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.