zoukankan      html  css  js  c++  java
  • if语句

     1 user='liangml'
     2 passwd='liangml'
     3 username=input('username:')
     4 password=input('password:')
     5 #优化前
     6 '''
     7 if user ==  username:
     8 print('usernameiscorrect...')
     9 if passwd == password:
    10 print('welcomelogin...')
    11 else:
    12 print('passwordifinvalid...')
    13 else:
    14 print('user name is not...')
    15 '''
    16 '''
    17 #优化后
    18 if user == username and passwd == password:
    19 print('Welcomelogin')
    20 else:
    21 print('Invalid user name or password...')
    22 '''
    23 
    24 --------------------分界线----------------------
    25 If语句猜年龄小游戏
    26 age=22
    27 guess_num=int(input('inputyourguessnum:'))
    28 if  guess_num==age:
    29 print('Congratulations!yougotit.')
    30 elif    guess_num>age:
    31 print('Thinksmaller!')
    32 else:
    33 print('ThinkBig...')
  • 相关阅读:
    人物装备的选取
    状压 + 背包
    村庄之间建立邮局
    woj
    括号匹配算面积(模拟)
    流程控制之if
    周末练习题(第一周)
    day04作业
    流程控制之for
    Python流程控制之while
  • 原文地址:https://www.cnblogs.com/liangml/p/5953734.html
Copyright © 2011-2022 走看看