当前位置:网站首页>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 .
边栏推荐
- UA camouflage, get and post in requests carry parameters to obtain JSON format content
- 截图工具Snipaste
- 不出网上线CS的各种姿势
- 技术干货|昇思MindSpore算子并行+异构并行,使能32卡训练2420亿参数模型
- Go language foundation ----- 11 ----- regular expression
- Lucene skip table
- Vertx's responsive MySQL template
- 技术干货|关于AI Architecture未来的一些思考
- Why is data service the direction of the next generation data center?
- PAT甲级 1031 Hello World for U
猜你喜欢

为什么说数据服务化是下一代数据中台的方向?

Go language foundation ----- 11 ----- regular expression

IPv4 address

Shengsi mindspire is upgraded again, the ultimate innovation of deep scientific computing

技术干货|昇思MindSpore NLP模型迁移之LUKE模型——阅读理解任务

项目经验分享:基于昇思MindSpore,使用DFCNN和CTC损失函数的声学模型实现

不出网上线CS的各种姿势

Go language foundation ----- 04 ----- closure, array slice, map, package

項目經驗分享:實現一個昇思MindSpore 圖層 IR 融合優化 pass

Application of pigeon nest principle in Lucene minshouldmatchsumscorer
随机推荐
最全SQL与NoSQL优缺点对比
Take you through the whole process and comprehensively understand the software accidents that belong to testing
图像识别与检测--笔记
Implementation of breadth first in aggregation in ES
HarmonyOS第三次培训笔记
不出网上线CS的各种姿势
【MySQL 11】怎么解决MySQL 8.0.18 大小写敏感问题
项目经验分享:基于昇思MindSpore实现手写汉字识别
Rabbit MQ message sending of vertx
昇思MindSpore再升级,深度科学计算的极致创新
Paper learning -- Study on the similarity of water level time series of Xingzi station in Poyang Lake
Reconnaissance et détection d'images - Notes
Go language foundation ------ 12 ------ JSON
项目经验分享:基于昇思MindSpore,使用DFCNN和CTC损失函数的声学模型实现
技术干货|昇思MindSpore NLP模型迁移之LUKE模型——阅读理解任务
Logging log configuration of vertx
Why is data service the direction of the next generation data center?
Es writing fragment process
Lucene introduces NFA
【LeetCode】2. Valid Parentheses·有效的括号