当前位置:网站首页>I've seen many tutorials, but I still can't write a program well. How can I break it?
I've seen many tutorials, but I still can't write a program well. How can I break it?
2022-07-06 20:19:00 【Crossin's programming classroom】
Zero basis python Introductory tutorial :python666.cn
Hello everyone , Welcome to Crossin Programming classroom of !
Recently, in the communication with students , It is found that many beginners are faced with such a problem : Learned some basic grammar , I can understand the examples in the book , But when it comes to a new programming problem , Still feel unable to start . The reason is , There are mainly two aspects :
On the whole , I don't know how to translate the problem into programming language .
In detail , I don't know how to realize a function .
For example, there is a problem in our code action programming example , The main idea is : Generate 200 A discount code , Each coupon code is provided by 8 It's made up of two letters ( Include case ).
Of course, the topic itself is not very difficult , And our official account 【 Every Monday 】 Compare the questions in the column , This is small case 了 . But if you're a new programmer , Only then can we master the condition judgment 、 loop 、 For beginners of the list , It's still a little bit of a challenge .
In this case , Some people have no idea of generating a string of characters directly , I don't know what to do . More people may have some ideas , But in the specific link , For example, how to generate random letters 、 How to spell a string 、 If you have trouble judging repetition . It can be seen from the participants' comments that , Many people exclaimed : It turns out that there is xxx This function 、 also yyy This module , I don't know at all .
So when developing programs , How to solve similar problems , And find the right way ? I'd like to share a few experiences :
1. Learn to break down problems
There's a joke about mathematicians being firefighters :
The fire chief asked : If a warehouse in the alley is on fire, how ? A mathematician : Connect the fire hydrant to the hose , Turn on the tap , Put out the fire . The captain said : Absolutely right ! What if you come to the alley and find that the warehouse is not on fire ? A mathematician : Light up the warehouse , So the problem is reduced to a known problem .
Put aside the exaggeration of the joke itself , As a programmer , You need to have a similar logic : Decomposition and transformation problems .
Generate 200 A discount code => Generate 1 A discount code , loop 200 Time
Generate 1 individual 8 Bit discount code => Generate 1 Characters , loop 8 Time
Generate 1 Random characters => Generate a random number , Convert to character
Generate a random number , It's a question we've been asking for a long time , use random Modules can be implemented . Then the thinking of this problem is quite clear . The rest is to deal with the details of the process : If you convert from numbers to characters 、 How to cycle 、 How to splice and so on .
But surely some students will say , I didn't even know numbers could be converted into characters . Some students will also say , You don't have to go around this bend at all , It can generate random characters directly . you 're right , Just like the mathematician who lit the warehouse , We have no problem with this logic , But in fact, it seems that there are still some two . So another important experience :
2. Learn to use search
Although most programmers major in Computer Science in College (science), But the role in the enterprise is Engineer (engineer). in other words , Programming is more practical than theoretical . Our goal is to solve the problem , What we need to master is the means and methods to solve the problem . For programmers , Search is a very effective way to find a solution .
But many students who have no programming experience may think that , When learning programming, finding a solution by searching is a kind of “ cheat ” The way , I didn't really understand how to solve the problem . There's no need for that . Even experienced programmers , And before we deal with it , Search for a more suitable solution . It's more valuable for you to search for solutions than to write this little program . I once wrote an article here , About how to use search engines : Programming beginners how to use search engines .
As far as the discount code is concerned , Through some simple search , We can find many similar solutions . Of course you can't search “ How to make 8 Bit discount code ”, But search “Python Generate random string ” Such keywords . Then you know : It can be used random Of sample、shuffle, And then there is string This module can utilize .
By the way . A classmate once asked : Does your tutorial include the knowledge needed for job hunting . This is a similar mistake . We are not going to take the college entrance examination , Review according to the outline , Then go to the examination room . Today's computer industry can be said to update faster than any industry , You can never “ Completely ” After mastering the knowledge of a certain field, develop it , You need to constantly face new technologies and new problems . So the knowledge about programming is changing , What we need to master is the same solution .

And for any field , The distribution of knowledge is like this picture , As you go further , The more knowledge gaps you face . This is also why many students after learning the basics , I can't find a suitable textbook to advance . Because there is no such textbook at all . In the primary stage , The pattern of your ability enhancement is Learning skills -> Practice your skills , And to a certain extent , The way to improve ability must be Have a problem -> Find a way to solve the problem , It's a process from passive to active . therefore , Students who want to go further , Don't look for textbooks , It's looking for problems , Use it again “ Search for ” This great tool to solve it .
The same is true of our teaching methods : We're not giving you textbooks , All the resources on the Internet should be your teaching materials . We'll give you a question , And how to find a solution to the problem .
3. Learn to look up documents
There is such a word in the programmer class :RTFM(Read The Fuxxing Manual, To read TMD Documentation manual )
There's a similar one STFW(Search The Fuxxing Web), It is corresponding to the first 2 spot .
I once a teacher pointed to a thick programming textbook and said to us : You don't have to remember these functions at all , It's enough to know where to look when you use it .
Search can tell you what solutions are available , And the official documents tell you more clearly how to use , What are the limitations of the parameters , Things to pay attention to and so on . The only regret is that , majority Fuxxing Manual It's all written in English . So you said , English is not good, in the end can learn programming . I can only say , Sure , But I strongly suggest you make up for your English .( The good news is that more and more documents are now available in Chinese )
Let's go back to the topic , adopt Python Official documents , You will know random What random operations can the module do , as well as string What strings can a module generate .
Last , And a little bit of platitude :
4. Keep practicing , Accumulate experience
I've said it countless times : Programming is like musical instruments , Learning grammar is just the beginning , It takes practice to master . Every programmer is a stack of lines of code . If you're new to programming , I feel like I lack programming thinking , I often sigh that there is still such operation , Write a little bit longer and you'll get old bug Words , believe me , You just write too little , Too little . Don't belittle yourself , There's no need to rush for success , Practice more first . After you input and run the sample code of a tutorial on your computer , Let's talk about programming thinking . This is not my original wonderful teaching method , Most programmers and computer teachers should agree with this .
The above is a little experience as a past person , I hope it can help people in need .
thank forward and give the thumbs-up The fellow ~
_ Previous articles are recommended _
And want to learn Python Students who have changed careers have a chat
If you need to know Paid premium courses And Teaching Q & a service
Please be there. Crossin Programming classroom of Internal reply : 666

边栏推荐
- PowerPivot——DAX(初识)
- JS implementation force deduction 71 question simplified path
- 腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发
- Deep learning classification network -- zfnet
- 报错分析~csdn反弹shell报错
- Logstash expressway entrance
- [cloud lesson] EI lesson 47 Mrs offline data analysis - processing OBS data through Flink
- Synchronization of data create trigger synchronization table for each site
- 5. 无线体内纳米网:十大“可行吗?”问题
- 腾讯安卓开发面试,android开发的基础知识
猜你喜欢

某东短信登录复活 安装部署教程

HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅

Leetcode question 283 Move zero
Tencent T2 Daniel explained in person and doubled his job hopping salary

Learn to punch in Web

Enumeration gets values based on parameters

RT thread I2C tutorial

Number of schemes from the upper left corner to the lower right corner of the chessboard (2)
腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发
腾讯架构师首发,2022Android面试笔试总结
随机推荐
5. 無線體內納米網:十大“可行嗎?”問題
持续测试(CT)实战经验分享
Cesium Click to draw a circle (dynamically draw a circle)
JS get browser system language
[cloud native and 5g] micro services support 5g core network
【每周一坑】正整数分解质因数 +【解答】计算100以内质数之和
小微企业难做账?智能代账小工具快用起来
Unity load AB package
Gui Gui programming (XIII) - event handling
Is it difficult for small and micro enterprises to make accounts? Smart accounting gadget quick to use
【云小课】EI第47课 MRS离线数据分析-通过Flink作业处理OBS数据
Rhcsa Road
Leetcode question 283 Move zero
5. Wireless in vivo nano network: top ten "feasible?" problem
PowerPivot - DAX (first time)
【计网】第三章 数据链路层(4)局域网、以太网、无线局域网、VLAN
A5000 vgpu display mode switching
JS implementation force deduction 71 question simplified path
Logstash expressway entrance
AddressSanitizer 技术初体验