Python入门-非计算机专业人士的编程指南

Python入门-非计算机专业人士的编程指南

5 (10人评价)
  • ¥9.90
  • 课时:(60)

  • 学员:(931)

  • 浏览:(30080)

  • 加入课程

再看猜数游戏的笔记

相关课时: 笔记详情:

import random,easygui


secret = random.randint(1,99)
guess = 0
tries = 0
easygui.msgbox("it a number between 1 to 99 ,you have 7 times to guess.")
while guess != secret and tries < 7 :
    guess = easygui.integerbox("a number you want :")
    if not guess : break
    if guess < secret :
         easygui.msgbox(str(guess)+"too small,pig")
    elif guess > secret :
         easygui.msgbox(str(guess)+"too big,pig")
    tries = tries + 1
if guess == secret:
    easygui.msgbox("well done,you get it")
else :
    
      easygui.msgbox("you have no chance,next time to play the  game !")

0 0

你感兴趣的课程

14万+浏览/ 10326学员/ 4.3评分
免费
办公软件 玩转 Excel 100 课
14万+浏览/ 469学员/ 4.8评分
¥16.00
13万+浏览/ 2468学员/ 4.5评分
免费