zoukankan      html  css  js  c++  java
  • python学习笔记2-tuple

    tuple:

    #元组也是List,但是值不能变
    a=('123','234','1234')
    print(a[1])
    
    mysql=('127.0.0.1','3306',''root','123456')
    print(mysql.count('root'))
    
    
    #例子
    all_user={}
    while True:
        username=input('username:').strip()
        passwd=input('passwd:').strip()
        cpwd=input('cpwd:').strip()
        if username and pwd and cpwd:
            if username in all_user:
                print('用户名已经存在')
            else:
                if pwd==cpwd :
                    all_user[username]=passwd
                else:
                    print('两次密码不一致')
        else:
            print('账号密码不能空')
    
    
    
    
    #登录例子
    all_users={}
    while True:
        username=input('username:').strip()
        passwd=input('passwd:').strip()
        if username and passwd:
           if username in all_users:
               passwd=all_users[username]
               if passwd==all_users[username]:
                  print('登录成功')
                  break
               else:
                  print('密码错误')
           else:
              print('用户名不存在')
        else:
            print('用户密码不能为空')
  • 相关阅读:
    1489 蜥蜴和地下室
    1521 一维战舰
    1596 搬货物
    1873 初中的算术
    CF-799B
    101 pick me up~
    落叶归根
    P1149 火柴棒等式
    P1540 机器翻译
    图论学习十之Sparse table
  • 原文地址:https://www.cnblogs.com/SuKiWX/p/8656550.html
Copyright © 2011-2022 走看看