当前位置:网站首页>Enter three times and guess a number
Enter three times and guess a number
2022-07-03 07:40:00 【Beauty of algorithm and programming】
1 introduction
Set up a system that can input three times , Users can guess a set number within three times .
2 problem describe
Enter a number n, Users can guess this number within three times .
Example :
Input :n=5
Enter the first time :n=2
Output :“ Wrong guess ”
Enter the second time :n=5
Output :“ Guess right ”
break
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
| n=int(input(' Please enter a number :')) for i in range(3): a=int(input(' Please enter your guess number :')) if(a==n): print(' Your guess is correct ') break else: print(' Your guess is wrong ') |
4 Conclusion
stay for Under the cycle , Set the number of cycles required , Let's have python Can be applied to life , for instance : Win the prize 、 User input, etc .
边栏推荐
- HCIA notes
- 不出网上线CS的各种姿势
- 【LeetCode】4. Best Time to Buy and Sell Stock·股票买卖最佳时机
- SQL create temporary table
- 【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结
- Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
- Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!
- Go language foundation ----- 15 ----- reflection
- Leetcode 213: 打家劫舍 II
- 你开发数据API最快多长时间?我1分钟就足够了
猜你喜欢

Go language foundation ----- 08 ----- interface

Comparison of advantages and disadvantages between most complete SQL and NoSQL

Technical dry goods | reproduce iccv2021 best paper swing transformer with Shengsi mindspire

Project experience sharing: Based on mindspore, the acoustic model is realized by using dfcnn and CTC loss function

IPv4 address

Why is data service the direction of the next generation data center?

TreeMap

Collector in ES (percentile / base)

Analysis of the problems of the 12th Blue Bridge Cup single chip microcomputer provincial competition

技术干货|百行代码写BERT,昇思MindSpore能力大赏
随机推荐
IPv4 address
Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
PAT甲级 1028 List Sorting
Logging log configuration of vertx
Use of file class
Collector in ES (percentile / base)
IndexSort
Go language foundation ----- 18 ----- collaboration security, mutex lock, read-write lock, anonymous lock, sync Once
Lucene skip table
Go language foundation ----- 09 ----- exception handling (error, panic, recover)
Go language foundation ----- 07 ----- method
UA camouflage, get and post in requests carry parameters to obtain JSON format content
Go language foundation ----- 02 ----- basic data types and operators
Go language foundation ----- 05 ----- structure
Project experience sharing: Based on mindspore, the acoustic model is realized by using dfcnn and CTC loss function
【开发笔记】基于机智云4G转接板GC211的设备上云APP控制
Some experiences of Arduino soft serial port communication
Technical dry goods | alphafold/ rosettafold open source reproduction (2) - alphafold process analysis and training Construction
Introduction of transformation flow
Go language foundation ----- 06 ----- anonymous fields, fields with the same name