当前位置:网站首页>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
边栏推荐
- Tencent byte Alibaba Xiaomi jd.com offer got a soft hand, and the teacher said it was great
- 22-07-05 upload of qiniu cloud storage pictures and user avatars
- OceanBase社区版之OBD方式部署方式单机安装
- 01 basic introduction - concept nouns
- JVM_常见【面试题】
- JS get browser system language
- 永磁同步电机转子位置估算专题 —— 基波模型与转子位置角
- JMeter server resource indicator monitoring (CPU, memory, etc.)
- 02 basic introduction - data package expansion
- 5. 无线体内纳米网:十大“可行吗?”问题
猜你喜欢
Notes on beagleboneblack
Le lancement du jupyter ne répond pas après l'installation d'Anaconda
[cloud native and 5g] micro services support 5g core network
【计网】第三章 数据链路层(4)局域网、以太网、无线局域网、VLAN
2022年6月语音合成(TTS)和语音识别(ASR)论文月报
22-07-05 七牛云存储图片、用户头像上传
【每周一坑】输出三角形
【云原生与5G】微服务加持5G核心网
【GET-4】
Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
随机推荐
Cesium Click to draw a circle (dynamically draw a circle)
PowerPivot - DAX (first time)
Rhcsa Road
系统与应用监控的思路和方法
Wechat applet common collection
Tencent T4 architect, Android interview Foundation
02 基础入门-数据包拓展
Anaconda安裝後Jupyter launch 沒反應&網頁打開運行沒執行
JVM_ Common [interview questions]
腾讯字节阿里小米京东大厂Offer拿到手软,老师讲的真棒
Guangzhou's first data security summit will open in Baiyun District
RT-Thread 组件 FinSH 使用时遇到的问题
青龙面板白屏一键修复
In unity space, an object moves around a fixed point on the sphere at a fixed speed
技术分享 | 抓包分析 TCP 协议
An East SMS login resurrection installation and deployment tutorial
某东短信登录复活 安装部署教程
Extraction rules and test objectives of performance test points
01 basic introduction - concept nouns
Leetcode brush first_ Maximum Subarray