程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

The stupid way to learn Python has been downloaded for 10000000 times as a PDF, which is a good introduction to learning Python

編輯:Python

Why study python

Mainstream programming language

There are programming languages in the world 600 Varied , But there are at most 20 or 30 kinds of products that are used in the mainstream , Different languages have their own characteristics and areas of expertise , With the continuous development of computers , New languages are coming into being , At the same time, there are many old languages that are slowly becoming useless . There is an authoritative language ranking website , You can see what the mainstream programming languages are !
2022 year 2 Monthly data (https://www.tiobe.com/tiobe-index/ ),python Has been promoted to the first place in the list of programming language use !

python A wide range of employment

Python Direction of employment

  • Web crawler : seeing the name of a thing one thinks of its function , Just use Python Collecting and crawling information from the Internet . Now learn Python A large part of the people in the team are learning to crawl , This is also Python One of the big advantages of , First use Python It's Google that does the web crawler .
  • web Development : Python There are many excellent Web Development framework , Such as Flask、Django、Bootstar etc. , Can help you quickly build a website . When a new feature is needed , use Python Just add a few lines of code , This is welcomed by many start-ups . image You know 、 douban Such a large factory , The earliest websites used Python Built .
  • Data analysis : In this era , Data is as valuable as gold , Such as : headlines 、 Tiktok and other products are built on user analysis. , Not to mention Taobao 、 JD.COM these “ Customized recommendation ” Old hand . so to speak , All commercial companies need such a role ,Python Data Analyst It has also become one of the hottest occupations at present .Python In the current data analysis business , The most commonly used language .
  • Automatic operation and maintenance : O & M Engineer Often monitor the operation of hundreds of machines , Or deployed at the same time . Use Python Can automate batch management of servers , Play a 1 Personal top 10 Personal effects . Automatic operation and maintenance is also Python It is one of the main application directions of , It's in system management 、 There are powerful functions in document management .
  • automated testing : The work of testing is boring and repetitive , in the past , Every product update , It's going to have to be tested over and over again , Inefficient and error prone .Python Provides a lot of frameworks for automated testing , Such as Selenium、Pytest etc. , Avoid a lot of duplication of work ,Python Automated testing is also becoming more and more popular .
  • Artificial intelligence : Artificial intelligence is one of the most popular directions at present , The salary is very high . You can see it on the recruitment website ,80K、100K There are also a lot of positions for . Of course, these positions also have relatively high requirements for education and technology .

python Easy to learn

1. Easy to learn :Python There are relatively few keywords , Simple structure , And a clearly defined grammar , It's easier to learn .
2. Easy to read :Python More clearly defined code .
3. Easy to maintain :Python The success is that its source code is fairly easy to maintain .
4. An extensive library of standards :Python One of the biggest advantages of is rich libraries , Cross platform , stay UNIX,Windows and Macintosh Very compatible .
5. Interactive mode : The support of interactive mode , You can input the execution code from the terminal and get the result language , Interactive test and debug code snippets .
6. portable : Based on its open source features ,Python It's been transplanted ( That is to make it work ) To many platforms .
7. Scalable : If you need a piece of critical code that runs fast , Or I want to write some algorithms that don't want to be open , You can use C or C++ Complete that part of the program , And then from your Python Call in program .
8. database :Python Interface to all major business databases .
9.GUI Programming :Python Support GUI Can be created and ported to many system calls .
10. Embeddable : You can take Python Embedded in C/C++ Program , Let users of your program get " scripting " The ability of .

How to learn python

Here I would like to recommend a book for you python Excellent introduction to , It's suitable for people who don't know much about computers , I haven't learned programming , But people who are interested in programming learn to use .

《 Stupid law enforcement Python》(Learn Python The Hard Way, abbreviation LPTHW) yes Zed Shaw A book written by Python Introductory books . This book guides the readers step by step in the way of exercises , From simple printing to the realization of the complete project . Maybe reading this book doesn't mean you've learned programming , But at least you'll have a rudimentary understanding of programming languages and the programming industry .

The features that distinguish this book from other introductory books are as follows :

  • Focus on practice . This book provides enough practice code , If you finish all the exercises ( Including bonus exercises ), Then you've written tens of thousands of lines of code . You know, many professional programmers write tens of thousands of lines of code a year .
  • Pay attention to ability training . Except as mentioned in the original preface “ Read and write ”、“ Pay attention to details ”、 as well as “ Find different ” Beyond this basic ability , The book also cultivates the reader's ability to specialize in questions and seek answers .
  • Pay attention to the cultivation of good habits . This book explains in detail how to write good code 、 Good note 、 Good project . This will save you a lot of detours in the follow-up study .

The structure of this book is very simple , In fact, that is 52 A problem set . among 26 One covers the input and output 、 Variable 、 And function , in addition 26 This one covers some advanced topics , Such as conditional judgment 、 loop 、 Classes and objects 、 Code testing 、 And the realization of the project . The format of each chapter is basically the same ,
Start with code exercises , The reader writes the code according to the instructions ( Copy and paste are not allowed ), Run and check the results , Then do some extra exercises . Of course, if you think the bonus exercise is a little difficult for you , You can also skip , It doesn't matter to finish it later .

Catalog

Because of the more content of the article , Space is not allowed , Some of the contents not shown are shown in the form of screenshots . If there is a need to obtain complete information documents of friends . Check the image below to get !

exercises 0 preparation 1

Mac OSX 1
OSX: Should see the results 2
Windows 2
Windows: Should see the results 3
Linux 4
Linux: Should see the results 5
A warning for beginners 5

exercises 1 The first program 7

Should see the results 8
Additional exercises 10
Frequently asked questions 11

exercises 2 Annotation and # Number 12

Should see the results 12
Additional exercises 13
Frequently asked questions 13

exercises 3 Numbers and mathematical calculations 14

Should see the results 15
Additional exercises 15
Frequently asked questions 16

exercises 4 Variables and naming 17

Should see the results 18
Additional exercises 18
Frequently asked questions 18

exercises 5 More variables and printing 20

Should see the results 21
Additional exercises 21
Frequently asked questions 21

exercises 6 String and text 23

Should see the results 24
Additional exercises 24
Frequently asked questions 24

exercises 7 More printing 26

Should see the results 26
Additional exercises 27
Frequently asked questions 27

exercises 8 Print , Print 28

Should see the results 28
Additional exercises 28
Frequently asked questions 29

exercises 9 Print , Print , Print 30

Should see the results 30
Additional exercises 31
Frequently asked questions 31

exercises 10 What is that 32

Should see the results 33
Escape sequences 33
Additional exercises 34
Frequently asked questions 34

exercises 11 put questions to 35

Should see the results 36
Additional exercises 36
Frequently asked questions 36

exercises 12 Prompt others 37

Should see the results 37
Additional exercises 38
Frequently asked questions 38

exercises 13 Parameters 、 Unpacking and variables 39

wait a minute !“ characteristic ” There's another name 39
Should see the results 40
Additional exercises 41
Frequently asked questions 41

exercises 14 Prompt and pass 42

Should see the results 42
Additional exercises 43
Frequently asked questions 43

exercises 15 Read the file 45

Should see the results 46
Additional exercises 46
Frequently asked questions 47

exercises 16 Read and write files 48

Should see the results 49
Additional exercises 50
Frequently asked questions 50

exercises 17 More file operations 51

Should see the results 52
Additional exercises 52
Frequently asked questions 53

exercises 18 name 、 Variable 、 Code and functions 54

Should see the results 55
Additional exercises 56
Frequently asked questions 56

exercises 19 Functions and variables 57

Should see the results 58
Additional exercises 58
Frequently asked questions 59

exercises 20 Functions and files 60

Should see the results 61
Additional exercises 61
Frequently asked questions 61

exercises 21 Function can return something 63

Should see the results 64
Additional exercises 64
Frequently asked questions 65

exercises 22 What have you learned so far 66

What I learned 66

exercises 23 Read some code 67

exercises 24 More practice 68

Should see the results 69
Additional exercises 69
Frequently asked questions 70

exercises 25 More practice 71

Should see the results 72
Additional exercises 73
Frequently asked questions 74

exercises 26 congratulations , Now you can take the exam ! 75

Frequently asked questions 75

exercises 27 Remember the logical relationship 76

Logical terms 76
Truth table 77
Frequently asked questions 78

exercises 28 Boolean expression exercise 79

Should see the results 80
Additional exercises 81
Frequently asked questions 81

exercises 29 if sentence 82

Should see the results 83
Additional exercises 83
Frequently asked questions 83

exercises 30 else and if 84

Should see the results 85
Additional exercises 85
Frequently asked questions 85

exercises 31 Make a decision 86

Should see the results 87
Additional exercises 87
Frequently asked questions 87

exercises 32 Loops and lists 89

Should see the results 90
Additional exercises 91
Frequently asked questions 91

exercises 33 while loop 93

Should see the results 94
Additional exercises 94
Frequently asked questions 95

exercises 34 Access the elements of the list 96

Additional exercises 97

exercises 35 Branches and functions 98

Should see the results 100
Additional exercises 100
Frequently asked questions 100

exercises 36 Design and commissioning 102

if Rules for statements 102
The rules of the cycle 102
Debugging tips 103
homework 103

exercises 37 Review various symbols 104

keyword 104
data type 105
String escape sequence 105
String formatting 106
The operator 106
Reading the code 107
Additional exercises 108
Frequently asked questions 108

exercises 38 List operation 109

Should see the results 111
Additional exercises 111
Frequently asked questions 112

exercises 39 Dictionaries , Lovely Dictionary 113

Should see the results 116
Additional exercises 116
Frequently asked questions 117

exercises 40 modular 、 Classes and objects 118

Modules are similar to dictionaries 118
Classes are similar to modules 119
Object is equivalent to mini import 120
Get what is contained in something 121
The first example of a class 121
Should see the results 122
Additional exercises 122
Frequently asked questions 123

exercises 41 Learn object-oriented terminology 124

Word practice 124
Vocabulary Practice 124
Mix consolidation exercises 125
Reading test 125
Practice from language to code 127
Read more code 128
Frequently asked questions 128

exercises 42 object 、 Classes and dependencies 129

What the code looks like 130
About class Name(object) 132
Additional exercises 132
Frequently asked questions 133

exercises 43 Basic object-oriented analysis and design 134

Simple game engine analysis 135
Write down or draw the question 135
Extract and study key concepts 135
Create class hierarchies and diagrams for various concepts
Object graph 136
Write and run various classes 137
Repeat and optimize 139
Top down and bottom up 139
《 come from Percal 25 The gotons of planet 》 Of
Code 139
Should see the results 145
Additional exercises 146
Frequently asked questions 146

exercises 44 Inheritance and composition 147

What is inheritance 147
Implicit inheritance 148
Explicit coverage 149
Replace... Before or after operation 149
A combination of three ways 151
Why use super() 152
super() and __init__ Use it with 152
synthesis 153
Applications of inheritance and composition 154
Additional exercises 154
Frequently asked questions 155

exercises 45 You make a game 156

Evaluate your game 156
The style of functions 157
Class style 157
Code style. 158
Good note 158
Score your game 158

exercises 46 Project skeleton 160

Python Package installation 160
Create skeleton project directory 161
The final directory structure 162
Test your configuration 164
Use this skeleton 164
quiz 164
Frequently asked questions 165

exercises 47 automated testing 166

Write test cases 166
Test Guide 168
Should see the results 169
Additional exercises 169
Frequently asked questions 169

exercises 48 More complex user input 170

Our game vocabulary 170
Punctuation 171
Vocabulary tuple 171
Scan input 171
Exceptions and numbers 171
What should be tested 172
Design tips 174
Additional exercises 174
Frequently asked questions 174

exercises 49 Create sentences 175

match and peek 175
Grammar of sentences 176
About anomalies 178
What should be tested 179
Additional exercises 179
Frequently asked questions 179

exercises 50 Your first website 180

install lpthw.web 180
Write a simple “Hello World” project 181
What's going to happen 182
Correct mistakes 183
Create a basic template file 183
Additional exercises 185
Frequently asked questions 186

exercises 51 Get input from the browser 187

Web How it works 187
How forms work 189
establish HTML Forms 191
Create layout templates 193
Write automatic test code for the form 194
Additional exercises 196
Frequently asked questions 197

exercises 52 establish Web game 198

Refactoring exercises 43 The game in 198
Session and user tracking 203
Create the engine 204
final exam 207
Frequently asked questions 208
The next way 209
How to learn any programming language 210

Because of the more content of the article , Space is not allowed , Some of the contents not shown are shown in the form of screenshots . If you need to get complete information and documents, please like them + Comment on stupid methodology python, Free access to .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved