当前位置:网站首页>User login
User login
2022-07-18 00:51:00 【Beauty of algorithm and programming】
0 introduction
In our daily life , Many times, users have to log in .
1 problem
Enter your username and password , Determine whether the user name and password are correct (’name’=’root’,’password’=’1234’). In order to prevent violent cracking , There are only three login opportunities , If there are more than three opportunities to report errors .
2 Method
use for There are only three login opportunities when the account name or password is wrong , Then use conditional statements , If the user name and password entered are correct , Just use break Stop the cycle . If you enter the wrong user name or password , Just continue typing , If you report an error more than three times .
3 Experimental results and discussion
Through the experiment 、 Practice has proved that the proposed method is effective , Is able to solve the problem raised at the beginning .
Code list 1
| for i in range(3): name=input(‘ Please enter a user name :’) password=input(‘ Please input a password :’) if name==’root’ and password==’1234’: print(‘ Login successful ’) break else: print(‘ Wrong user name or password ’) |
4 Conclusion
Loop and conditional sentences are used in this problem , Use the loop to design the user login system , Limit user login times to prevent forced login , It ensures the security of the user's account , It is of great significance .
边栏推荐
- CF1265E Beautiful Mirrors (概率dp)
- BeautifulSoap基本使用
- Kali install Nessus
- kali安装Nessus
- SHAREit Group的技术战略——开放、自立、超前布局
- Practice teach you how to design WiFi voice broadcast schedule with stm32
- 【redis】redis加锁的几种思路及试验
- 综合评价的基本理论
- Image classification based on convolutional neural network
- [source code] what is the difference between ArrayList and vector, and the difference of expansion multiple
猜你喜欢

【面试题】在 Queue 中 poll()和 remove()有什么区别

This is the most detailed arrangement of the basic knowledge of network workers in the whole network, and there is no one
![[tutorial] idea plug-in translation translation shortcut keys and translation settings](/img/26/7c200136a74ada6c065372412bfdba.png)
[tutorial] idea plug-in translation translation shortcut keys and translation settings

PAT. A1003 Emergency

大端字节序和小端字节序

【直播课】腾讯课堂------基于GO语言的云原生工具二次开发实战训练营-------Kubernetes Operator开发

【教程】idea插件translation翻译快捷键及翻译设置

Easy to play minesweeping

MFC file reading and writing based on a single document

Pytorch notes: ddpg (datawhale code interpretation)
随机推荐
018.代理模式结和Filter做的一个屏蔽敏感词汇
Typescript 14 starting from 0: built in tool type
Red hat official announced the new president and CEO! Paul Cormier, a key figure in transformation, is "retiring"
Neuron and metahunan drive whole body steps in real time
Test cases and test reports
【源码】HashSet的实现原理
Interesting and informative. A cognitive upgrade of zero trust network security architecture
Q3 qmainwindow status bar riveted parts core parts
这段sql在pg执行会报错,Oracle没问题
[interview question] what is the difference between poll() and remove() in the queue
PAT. A1018 Public Bike Management
Why is there no Productism in Wei Lai?
ShareIt group's technology strategy - open, self-supporting and advanced layout
[kapok] Summer Challenge # Hongmeng small game project Sudoku
Pytorch(二)——PyTorch的主要组成模块
Q5 standard dialog box
【文档熟肉】redis数据类型
[mathematical modeling summer training] matlab drawing command
大家有没有遇到过flink-oracle-cdc 获取最新的日志 卡住的情况?怎么解决?
Summer precipitation Web Learning - SQL injection Foundation (Basic & Digital & character)