zoukankan      html  css  js  c++  java
  • 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.......')
  • 相关阅读:
    codevs1080线段树练习
    NOIP2015 子串
    codevs1204 寻找子串位置
    字符串匹配的KMP算法
    TYVJ1460 旅行
    基础
    搜索
    二叉排序树
    二叉树
    poj
  • 原文地址:https://www.cnblogs.com/liuyoushui/p/6012445.html
Copyright © 2011-2022 走看看