zoukankan      html  css  js  c++  java
  • day_05作业

    1. 判断姑娘年龄

      age_inp = int(input('请输入姑娘的年龄:'))
      if age_inp < 18:
          print('不接受未成年')
      elif age_inp>=18 and age_inp<25:
          print('心动表白')
      elif age_inp>=25 and age_inp <45:
          print('阿姨好')
      else:
          print('奶奶好')
      
    2. 打印1-100之间的奇数和

      count=0
      s=0
      while count<100:
          if count%2==1:
              s+=count
          count += 1
      print(s)
      
    3. 猜年龄游戏

      count=0
      age=20
      while count<3:
          age_inp=int(input('请输入年龄:》》'))
          if age_inp==age:
              print('猜对了')
              break
          elif age_inp > age:
              print('猜大了')
          else:
              print('猜小了')
          count+=1
          print(f'你还有{3-count}次机会!!')
          if count==3:
              choice_inp=input('游戏结束,输入Y或y就可以重新开始,输入N或n则退出游戏:')
              if choice_inp in ['Y','y']:
                   count=0
              else:
                  pass
      
  • 相关阅读:
    Git 操作
    SVN
    一维数组
    常见的数学方法
    常用事件
    function函数
    while;do while; for循环
    JS中的变量提升
    关于js的单双引号嵌套问题
    db.collection is not a function
  • 原文地址:https://www.cnblogs.com/maqiaobin/p/11506809.html
Copyright © 2011-2022 走看看