当前位置:网站首页>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 .
边栏推荐
- 技术干货|AI框架动静态图统一的思考
- [set theory] Stirling subset number (Stirling subset number concept | ball model | Stirling subset number recurrence formula | binary relationship refinement relationship of division)
- OSI knowledge sorting
- Unified handling and interception of exception exceptions of vertx
- Leetcode 198: 打家劫舍
- The difference between typescript let and VaR
- 技术干货|百行代码写BERT,昇思MindSpore能力大赏
- Technical dry goods Shengsi mindspire operator parallel + heterogeneous parallel, enabling 32 card training 242 billion parameter model
- SQL create temporary table
- Lombok cooperates with @slf4j and logback to realize logging
猜你喜欢

Lucene introduces NFA

圖像識別與檢測--筆記

PAT甲级 1030 Travel Plan

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

Common architectures of IO streams

Introduction of buffer flow

Go language foundation ----- 05 ----- structure

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

Go language foundation ----- 15 ----- reflection

你开发数据API最快多长时间?我1分钟就足够了
随机推荐
Common methods of file class
HarmonyOS第三次培训笔记
Go language foundation ------ 12 ------ JSON
Lombok cooperates with @slf4j and logback to realize logging
[mindspire paper presentation] summary of training skills in AAAI long tail problem
[set theory] order relation (partial order relation | partial order set | example of partial order set)
Lucene skip table
技术干货|昇思MindSpore初级课程上线:从基本概念到实操,1小时上手!
技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!
Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience
Reconnaissance et détection d'images - Notes
Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
Go language foundation ----- 15 ----- reflection
An overview of IfM Engage
Go language foundation ----- 08 ----- interface
Application of pigeon nest principle in Lucene minshouldmatchsumscorer
密西根大学张阳教授受聘中国上海交通大学客座教授(图)
Paper learning -- Study on the similarity of water level time series of Xingzi station in Poyang Lake
PAT甲级 1032 Sharing
Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!