首页 > 代码库 > python 3.5 猜数字游戏
python 3.5 猜数字游戏
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 猜数字游戏
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。