当前位置:网站首页>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 .
边栏推荐
- Traversal in Lucene
- c语言指针的概念
- Leetcode 213: 打家劫舍 II
- Implementation of breadth first in aggregation in ES
- 基于RNA的新型癌症疗法介绍
- Vertx restful style web router
- Technical dry goods Shengsi mindspire innovation model EPP mvsnet high-precision and efficient 3D reconstruction
- OSI knowledge sorting
- Technical dry goods Shengsi mindspire operator parallel + heterogeneous parallel, enabling 32 card training 242 billion parameter model
- 【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结
猜你喜欢

Go language foundation ----- 07 ----- method

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

Application of pigeon nest principle in Lucene minshouldmatchsumscorer

Image recognition and detection -- Notes

c语言指针的概念

Go language foundation ----- 01 ----- go language features

你开发数据API最快多长时间?我1分钟就足够了

Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!

技术干货|昇思MindSpore Lite1.5 特性发布,带来全新端侧AI体验

Take you through the whole process and comprehensively understand the software accidents that belong to testing
随机推荐
Es writing fragment process
【MySQL 13】安装MySQL后第一次修改密码,可以可跳过MySQL密码验证进行登录
c语言指针的概念
Beginners use Minio
Use of file class
Chapter VI - Containers
Go language foundation ------ 12 ------ JSON
Lombok cooperates with @slf4j and logback to realize logging
HCIA notes
FileInputStream and fileoutputstream
输入三次猜一个数字
PAT甲级 1027 Colors in Mars
Analysis of the problems of the 7th Blue Bridge Cup single chip microcomputer provincial competition
Go language foundation ----- 01 ----- go language features
Go language foundation ----- 08 ----- interface
Hnsw introduction and some reference articles in lucene9
Custom generic structure
Lucene skip table
Hello world of vertx
Vertx multi vertical shared data