Tuple:
#tuples are also lists, but the values do not changeA= ('123','234','1234')Print(a[1]) MySQL=('127.0.0.1','3306',"'Root','123456')Print(Mysql.count ('Root'))#ExampleAll_user={} whileTrue:username=input ('Username:'). Strip () passwd=input ('passwd:'). Strip () Cpwd=input ('cpwd:'). Strip ()ifUsername andPwd andcpwd:ifUsernameinchAll_user:Print('user name already exists') Else: ifpwd==Cpwd:all_user[username]=passwdElse: Print('two times password inconsistency') Else: Print('account password cannot be empty')#Login Examplesall_users={} whileTrue:username=input ('Username:'). Strip () passwd=input ('passwd:'). Strip ()ifUsername andpasswd:ifUsernameinchall_users:passwd=All_users[username]ifpasswd==All_users[username]:Print('Login Successful') Break Else: Print('Password Error') Else: Print('user name does not exist') Else: Print('The user password cannot be empty')
Python Learning Note 2-tuple