当前位置:网站首页>登录界面代码
登录界面代码
2022-07-05 13:53:00 【算法与编程之美】
0 引言
我们已经学习了很多的Python知识,但是很抽象,并不知道这些代码在我们现实生活中的实际运用。我想在今天app迅速发展的信息化时代,我们要想进入某个APP或者某个界面就会要就我们输入账号和密码,这是对我们个人信息安全的保护;但是,你知道登录流程是怎么来的嘛?今天我们就来用一个简单的代码来解析我们现在生活中经常遇到的登录界面的源。
1 问题
在信息化时代,我们最担心的就是个人的隐私问题,我们在使用软件时,软件里面会收集我们的个人信息,如果不法份子收集并且使用了我们的信息,那么后果将不堪设想。所以,我们要设置登陆界面,通过输入密码来进入软件,那么我们该怎么来做呢?
2 方法
首先创建两个输入行分别命名为账号与密码,然后输入用for in循环来将输入机会设为三次,再用if条件句来判断输入是否正确,每输错就报错,如果三次都没输对就输出‘该用户已锁定’。如果输入正确就输出‘成功登录’。
3 实验结果与讨论
最后通过实验证明,该方法执行有效:
代码清单 1
| n=input('账号:') m=input('密码:') for i in range(2): if n=='daiwei' and m=='5201314': print('成功登录') break else: print('输入错误') print('<'*10) print('1、重新输入') print('2、退出') option = input("请选择:") if option=='1': n = input('账号:') m = input('密码:') if n == 'daiwei' and m == '5201314': print('成功登录') else: print('该号已锁定') |
4 结语
最后,我们就将简单的登录界面的代码打出来啦!该代码偏于基础,主要难点就在用循环来统计次数上,至于一般程序,我们进入登录后还会有更多的操作,具体内容我们下次再谈。
边栏推荐
- Data Lake (VII): Iceberg concept and review what is a data Lake
- Laravel framework operation error: no application encryption key has been specified
- Request + BS4 crawl Netease cloud music popular comments
- Liar report query collection network PHP source code
- kafaka 日志收集
- 研究生可以不用学英语?只要考研英语或六级分数高!
- 2022年机修钳工(高级)考试题模拟考试题库模拟考试平台操作
- How to deal with the Yellow Icon during the installation of wampserver
- What is information security? What is included? What is the difference with network security?
- Redis6 data type and operation summary
猜你喜欢

深拷贝真难

内网穿透工具 netapp

Rk3566 add LED

常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...

Internal JSON-RPC error. {"code":-32000, "message": "execution reverted"} solve the error
![[server data recovery] a case of RAID5 data recovery stored in a brand of server](/img/04/c9bcf883d45a1de616c4e1b19885a5.png)
[server data recovery] a case of RAID5 data recovery stored in a brand of server

Summit review | baowanda - an integrated data security protection system driven by compliance and security

嵌入式软件架构设计-消息交互

Redis6 transaction and locking mechanism

jasypt配置文件加密|快速入门|实战
随机推荐
LeetCode_3(无重复字符的最长子串)
明峰医疗冲刺科创板:年营收3.5亿元 拟募资6.24亿
Hide Chinese name
RK3566添加LED
2022司钻(钻井)考试题库及模拟考试
那些考研后才知道的事
Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails
Set up a website with a sense of ceremony, and post it to the public 2/2 through the intranet
LeetCode_69(x 的平方根 )
荐号 | 有趣的人都在看什么?
Laravel dompdf exports PDF, and the problem of Chinese garbled code is solved
redis6主从复制及集群
How to divide a large 'tar' archive file into multiple files of a specific size
Those things I didn't know until I took the postgraduate entrance examination
Log4j utilization correlation
鏈錶(簡單)
LeetCode_2(两数相加)
如何把大的‘tar‘存档文件分割成特定大小的多个文件
链表(简单)
Liste des liens (simple)