码迷,mamicode.com
首页 > 编程语言 > 详细

python 3.5 猜数字游戏

时间:2016-10-30 09:29:11      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:pre   log   int   3.5   encoding   数字游戏   put   ber   game   

 1 #!/usr/bin/env python
 2 #encoding: utf-8
 3 number = 88
 4 
 5 for i in range(1,6):
 6     num = int(input(‘gusee number game(5 机会):‘))
 7     print(‘第 %s 机会‘ % (i))
 8     if num >number:
 9         print (‘big‘)
10     elif num < number:
11         print (‘small‘)
12     elif num == number:
13         print (‘good‘)
14         break
15 
16 if num == number:
17     print (‘good luck‘)
18     print (‘welcome to next come on.......‘)
19 else:
20     print (‘no good luck‘)
21     print(‘welcome to next come on.......‘)
 1 #!/usr/bin/env python
 2 #encoding: utf-8
 3 number = 88
 4 
 5 a = 1
 6 while a <= 5:
 7     num = int(input(‘gusee number game(5 机会):‘))
 8     print(‘第 %s 机会‘ % (a))
 9     if num >number:
10         print (‘big‘)
11     elif num < number:
12         print (‘small‘)
13     elif num == number:
14         print (‘good‘)
15         break
16     a += 1
17 
18 if num == number:
19     print (‘good luck‘)
20     print (‘welcome to next come on.......‘)
21 else:
22     print (‘no good luck‘)
23     print(‘welcome to next come on.......‘)

 

python 3.5 猜数字游戏

标签:pre   log   int   3.5   encoding   数字游戏   put   ber   game   

原文地址:http://www.cnblogs.com/liuyoushui/p/6012445.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!