当前位置:网站首页>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 .
边栏推荐
- Some experiences of Arduino soft serial port communication
- Es writing fragment process
- Go language foundation ----- 10 ----- string related operations (operation function, string conversion)
- 技术干货|关于AI Architecture未来的一些思考
- An overview of IfM Engage
- JUnit unit test of vertx
- IO stream system and FileReader, filewriter
- Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward
- 密西根大学张阳教授受聘中国上海交通大学客座教授(图)
- Common operations of JSP
猜你喜欢
PAT甲级 1027 Colors in Mars
Go language foundation ----- 04 ----- closure, array slice, map, package
[coppeliasim4.3] C calls UR5 in the remoteapi control scenario
Go language foundation ----- 16 ----- goroutine, GPM model
Understanding of class
论文学习——鄱阳湖星子站水位时间序列相似度研究
圖像識別與檢測--筆記
[set theory] Stirling subset number (Stirling subset number concept | ball model | Stirling subset number recurrence formula | binary relationship refinement relationship of division)
昇思MindSpore再升级,深度科学计算的极致创新
Shengsi mindspire is upgraded again, the ultimate innovation of deep scientific computing
随机推荐
Beginners use Minio
TypeScript let与var的区别
experiment.........
Pgadmin 4 v6.11 release, PostgreSQL open source graphical management tool
Go language foundation ----- 01 ----- go language features
Technical dry goods Shengsi mindspire operator parallel + heterogeneous parallel, enabling 32 card training 242 billion parameter model
项目经验分享:实现一个昇思MindSpore 图层 IR 融合优化 pass
Collector in ES (percentile / base)
PAT甲级 1031 Hello World for U
Circuit, packet and message exchange
技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!
Reconnaissance et détection d'images - Notes
Introduction of buffer flow
SQL create temporary table
技术干货|昇思MindSpore NLP模型迁移之Roberta ——情感分析任务
Hisat2 - stringtie - deseq2 pipeline for bulk RNA seq
Traversal in Lucene
Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
Go language foundation ----- 02 ----- basic data types and operators
VMware network mode - bridge, host only, NAT network