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

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

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

  • 学员:(931)

  • 浏览:(27427)

  • 加入课程

第二个 Python 程序的笔记

相关课时: 笔记详情:

import random
secret = random.randint(1,100)
guess = 0
tries = 0
print("a ha,i'm jack,i have a secret!")
print("it is a number between 1 to 99,you have six times to guess,come on!")
while guess != secret and tries < 6:
    guess = int(input("a number:"))
    if guess < secret:
        print("too small")
    elif guess > secret:
        print("too big")
    tries = tries + 1
if guess == secret:
    print("well done,you got it.")
else:
    print("you have no chance,next time.")
    print("it is",secret)

 

0 0

你感兴趣的课程

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