[Ebook]  Programming with Python - PDF

[Ebook] Programming with Python - PDF

Tác giả: Ebook3000
Thể Loại: Công Nghệ Thông Tin
Mua : Sách giảm giá(10-40%)
Download - Tải sách

[Ebook] Programming with Python - PDF


Contents

1 Python–A Calculator...................................... 1
Reference ............................................... 5
2 Algebra with Variables .................................... 7
2.1 Variables........................................... 7
2.2 Complex Quantities .................................. 11
2.3 Common Functions with Numbers ....................... 11
2.4 Logical Operators .................................... 14
2.5 Strings and Printing .................................. 15
2.6 Exercises........................................... 16
References............................................... 17
3 Simple Programs......................................... 19
3.1 Basic Program Structure ............................... 19
3.2 Flow Chart ......................................... 24
3.3 Conditional Operations ................................ 26
3.4 Iterative Routines .................................... 31
3.5 Exercises........................................... 36
References............................................... 39
4 Functions and Modules.................................... 41
4.1 Functions .......................................... 41
4.1.1 Lambda Function.............................. 45
4.1.2 Recursion ................................... 46
4.1.3 Nested Functions.............................. 47
4.1.4 Nested Scope................................. 50
4.2 Modules ........................................... 52
4.2.1 Built-in Modules .............................. 62
4.2.2 Math Module................................. 62
4.3 Exercises........................................... 64
References............................................... 68

ix

5 Sequences and Operations with Sequences .................... 69
5.1 String ............................................. 69
5.2 Tuple ............................................. 71
5.3 List ............................................... 72
5.4 Dictionary.......................................... 73
5.5 Set ............................................... 73
5.6 Operators with Sequences.............................. 75
5.6.1 All and Any ................................ 75
5.6.2 sum and eval ............................... 77
5.7 Iterator ............................................ 78
5.8 Iterator Functions .................................... 81
5.9 Generators ......................................... 86
5.10 Hashing ........................................... 88
5.11 Input .............................................. 89
5.12 Exercises........................................... 91
References............................................... 97
6 Additional Operations with Sequences........................ 99
6.1 Slicing ............................................ 99
6.2 Reversing .......................................... 103
6.3 Sorting ............................................ 104
6.4 Operations with Sequences............................. 108
6.4.1 Max() and Min() Functions...................... 109
6.4.2 Additional Operations with Sequences ............. 112
6.5 Operations with Sets.................................. 115
6.6 Frozensets.......................................... 122
6.7 Tests and Comparisons with Sets and Frozensets ............ 123
6.8 Operations with Dictionaries............................ 124
6.9 *Arg and **Kwarg ................................... 129
6.10 Exercises........................................... 133
References............................................... 136
7 Operations for Text Processing ............................. 137
7.1 Unicode ........................................... 137
7.2 Coding ............................................ 138
7.2.1 UTF-8 ...................................... 138
7.3 Operations with string S ............................ 141
7.4 Number Representations and Conversions ................. 144
7.4.1 Integers ..................................... 145
7.4.2 Floating Point Numbers......................... 146
7.5 More String Operations ............................... 149
7.6 bytes and bytearrays............................. 157
7.7 Other Operations with Sequences ........................ 166
7.8 string Module .................................... 166
x Contents

7.9 Exercises........................................... 167
References............................................... 174
8 Operations with Files ..................................... 175
8.1 Printing............................................ 175
8.2 String Formatting .................................... 178
8.2.1 Formatting—Version I.......................... 179
8.2.2 Formatting—Version II ......................... 182
8.3 Files and Related Operations ........................... 188
8.3.1 String/Text Files .............................. 188
8.4 Exercises........................................... 195
Reference ............................................... 197
9 Application Modules ...................................... 199
9.1 random Module .................................... 199
9.1.1 Distribution Functions .......................... 203
9.2 statistics Module ..................................... 205
9.3 Array Module ....................................... 207
9.4 bisect Module ....................................... 214
9.5 heapq Module...................................... 216
9.6 Exercises........................................... 222
References............................................... 229
10 Classes and Objects....................................... 231
10.1 Objects ............................................ 232
10.2 Classes ............................................ 232
10.2.1 Instantiation.................................. 235
10.3 Functions with Attributes .............................. 239
10.4 pass : Place Holder ................................. 241
10.5 Overloading ........................................ 242
10.5.1 Overloading in Basic Python..................... 246
10.6 Inheritance ......................................... 247
10.6.1 Multiple Inheritances........................... 249
10.7 super() ........................................... 252
10.8 Execution from Command Line ......................... 259
10.9 Exercises........................................... 262
Reference ............................................... 264
11 Time Related Operations .................................. 265
11.1 Time Standards...................................... 265
11.2 time Module....................................... 267
11.3 datetime Module .................................. 274
11.3.1 time Objects ................................ 276
11.3.2 datetime Objects............................ 277
11.3.3 Time Intervals ................................ 280
Contents xi

11.3.4 tzinfo .................................... 282
11.3.5 Algebra with Time Objects ...................... 285
11.4 Calendars .......................................... 287
11.5 timeit Module .................................... 295
11.6 Exercises........................................... 299
References............................................... 300
12 Functional Programming Aids .............................. 301
12.1 operator Module .................................. 301
12.1.1 Generic Methods .............................. 305
12.1.2 Inplace Operators.............................. 307
12.2 itertools........................................ 308
12.2.1 Filtering..................................... 315
12.3 generator Using yield ............................ 319
12.4 iterator Formation ................................ 325
12.5 decoratorS ...................................... 327
12.6 functools........................................ 327
12.6.1 total_ordering ........................... 329
12.6.2 single dispatch Generic Function............. 329
12.6.3 partial Objects............................. 331
12.6.4 Reduction Functions ........................... 332
12.7 Exercises........................................... 332
References............................................... 337
Index ...................................................... 339

Sách cùng chủ đề

Tài liệu Lập Trình Python Tiếng Việt cơ bản PDF - Võ Duy Tuấn

Giới thiệu Hiện nay, Python là một trong những ngôn ngữ lập trình đang được chú ý bởi tính đa dạng về ứn ...

[Ebook] Programming with Python - PDF

Contents 1 Python–A Calculator...................................... 1 Reference ............................................... 5 2 Algeb ...

Lập trình Blockchain trong C# (.NET)

Blockchain là một công nghệ thực sự thú vị, nhưng nó chủ yếu vẫn còn rất khó thực hiện. Các &quo ...

Open Source Book: Programming the Blockchain in C#

Blockchain is a really interesting technology, but it’s mostly remained very difficult to implement. The “Programming the Blockchain in C ...

A Gentle Introduction To Blockchain Technology

Part 1 - Executive Summary........................................................................................................4 Part 2 - Introdu ...

Video - 26 VIDEO DẠY PHOTOSHOP TỪ A-Z

[Bài 01] Tìm Hiểu Giao Diện Photoshop Và Vùng làm việc.mp4 [Bài 02] Cách thức làm việc của ...

[ASP.NET MVC] - Tài liệu ASP.NET MVC của Nhất Nghệ phần 2

Tài liệu học ASP.NET MVC 5 do trung tâm Nhất Nghệ biên soạn Phân 2 : Controller Link: google drive Xem phần 1 tại đ ...

[Ebook English] Programming Razor

Take Razor for a test drive and discover first hand how this scripting syntax simplifies the way you create dynamic, data-driven websites. With this ...

[ASP.NET MVC] - Tài liệu ASP.NET MVC của Nhất Nghệ phần 1

Controller Nhận yêu cầu từ user Xử lý và xây dựng model phù hợp Chuyển Model cho View  View Tiếp nhận Mode ...

MongoDB in Action

MongoDB in Action is a comprehensive guide to MongoDB for application developers. The book begins by explaining what makes MongoDB unique and de ...