Cart

Python Without Fear, 1st edition

BRAND: PEARSON

Publisher:Addison-Wesley Professional
Author: Brian Overland
Edition: (September 27, 2017) © 2018
eBook ISBN:9780134688275
Print ISBN: 9780134687476
Type: 1 Year Subscription. Dành cho Cá nhân  

eBook edition. 1 year Subscription. Dành cho Cá nhân  |  Trường ĐH, Nhóm, Thư Viện: Gọi 0915920514 để báo giá Pearson, Vital Source eBook hoặc mua Sách In  

Số lượng:
Tổng tiền:
Giá có thể thay đổi bất kỳ khi nào.
Thời hạn giao hàng: 03 ngày làm việc với sách eBook và 30 ngày với sách In. Gọi để được Tư vấn Giáo Trình.

Mô tả sản phẩm


Python không sợ hãi sẽ là cuốn sách lý tưởng cho những người đã từng lập trình bằng bất kỳ ngôn ngữ nào trước đây—chẳng hạn như C, C++, Basic hoặc Java—và muốn học Python một cách dễ dàng và đáng tin cậy nhất có thể. Nó cũng sẽ cung cấp một hướng dẫn dễ đọc giải thích cách thức hoạt động của Python. Nói tóm lại, đây là cuốn sách Python dành cho người mới bắt đầu đến trung cấp lý tưởng.


Preface xvii

Acknowledgments xxi

Author Bio xxiii

Chapter 1: Meet the Python 1

A Brief History of Python 1

How Python Is Different 2

How This Book Works 3

Installing Python 4

Begin Using Python with IDLE 6

Correcting Mistakes from Within IDLE 6

Dealing with Ends of Lines 7

Additional Help: Online Sources 8

Chapter 2: A Python Safari: Numbers 9

Python and Numbers 9

Python and Floating-Point Numbers 14

Assigning Numbers to Variables 17

Variable-Naming Conventions in This Book 23

Some Python Shortcuts 23

Chapter 2 Summary 26

Chapter 3: Your First Programs 29

Temperatures Rising? 29

Putting in a Print Message 35

Syntax Summaries 36

Getting String Input 41

Getting Numeric Input 43

Formatted Output String 46

Chapter 3 Summary 50

Chapter 4: Decisions and Looping 53

Decisions Inside a Computer Program 53

Conditional and Boolean Operators 55

The if, elif, and else Keywords 56

while: Looping the Loop 60

 “Give Me a break” Statement 70

Chapter 4 Summary 75

Chapter 5: Python Lists 77

The Python Way: The World Is Made of Collections 77

Processing Lists with for 80

Modifying Elements with for (You Can't!) 82

Indexing and Slicing 85

Copying Data to Slices 88

Ranges 89

List Functions and the in Keyword 97

Chapter 5 Summary 99

Chapter 6: List Comprehension and Enumeration 101

Indexes and the enumerate Function 101

The Format String Method Revisited 103

Simple List Comprehension 106

“Two-Dimensional” List Comprehension 112

List Comprehension with Conditional 114

Chapter 6 Summary 123

Chapter 7: Python Strings 125

Creating a String with Quote Marks 125

Indexing and “Slicing” 127

String/Number Conversions 130

Stripping for Fun and Profit 135

Let’s Split: The split Method 138

Building Strings with Concatenation (+) 139

The join Method 143

Chapter 7 Summary 144

Chapter 8: Single-Character Ops 147

Naming Conventions in This Chapter 147

Accessing Inpidual Characters (A Review) 148

Getting Help with String Methods 148

Testing Uppercase vs. Lowercase 149

Converting Case of Letters 150

Testing for Palindromes 151

Converting to ASCII Code 159

Converting ASCII to Character 160

Chapter 8 Summary 166

Chapter 9: Advanced Function Techniques 167

Multiple Arguments 167

Returning More Than One Value 168

Arguments by Name 173

Default Arguments 174

Importing Functions from Modules 178

Chapter 9 Summary 185

Chapter 10: Local and Global Variables 187

Local Variables, What Are They Good For? 187

Locals vs. Globals 188

Introducing the global Keyword 190

The Python “Local Variable Trap” 190

Chapter 10 Summary 204

Chapter 11: File Ops 207

Text Files vs. Binary Files 207

The Op System (os) Module 208

Open a File 211

Let’s Write a Text File 213

Read a Text File 216

Files and Exception Handling 217

Other File Modes 223

Chapter 11 Summary 224

Chapter 12: Dictionaries and Sets 227

Why Do We Need Dictionaries, Ms. Librarian? 227

Adding and Changing Key-Value Pairs 229

Accessing Values 230

Searching for Keys 231

Converting Dictionaries to Lists 235

All About Sets 241

Operations on Sets 242

Chapter 12 Summary 246

Chapter 13: Matrixes: 2-D Lists 249

Simple Matrixes 249

Accessing Elements 250

Irregular Matrixes and Length of a Row 251

Multiplication (*) and Lists 252

The Python Matrix Problem 253

How to Create N*M Matrixes: The Solution 254

How to Rotate a Matrix 261

Chapter 13 Summary 268

Chapter 14: Winning at Tic-Tac-Toe 271

Design of a Tic-Tac-Toe Board 271

Plan of This Chapter 273

Python One-Line if/else 274

The count Method for Lists 279

Introducing the Computer Player 285

Chapter 14 Summary 294

Chapter 15: Classes and Objects I 295

What’s an Object? 295

Classes in Python 296

The All-Important _ _init_ Method 301

Design for a Database Class 303

Defining Other Methods 309

Design for a Point3D Class 310

Point3D Class and Default Arguments 312

Three-Dimensional Tic-Tac-Toe 312

Chapter 15 Summary 318

Chapter 16: Classes and Objects II 321

Getting Help from Doc Strings 321

Function Typing and “Overloading” 323

Variable-Length Argument Lists 326

Inheritance 331

The Fraction Class 333

Class Variables and Methods 337

Instance Variables as “Default” Values 339

Chapter 16 Summary 344

Chapter 17: Conway’s Game of Life 347

Game of Life: The Rules of the Game 348

Generating the Neighbor Count 350

Design of the Program 352

Moving the Matrix Class to a Module 354

The Famous Slider Pattern 358

Chapter 17 Summary 364

Chapter 18: Advanced Pythonic Techniques 367

Generators 367

Exploiting the Power of Generators 369

Properties 375

Decorators: Functions Enclosing Other Functions 382

Python Decoration 385

Chapter 18 Summary 389

Appendix A: Python Operator Precedence Table 391

Appendix B: Summary of Most Important Formatting Rules for Python 3.0 393

1. Formatting Ordinary Text 393

2. Formatting Arguments 393

3. Specifying Order of Arguments 393

4. Right Justification Within Field of Size N 394

5. Left Justification Within Field of Size N 394

6. Truncation: Limit Size of Print Field 394

7. Combined Truncation and Justification 395

8. Length and Precision of Floating-Point Numbers 395

9. The Padding Character 395


Appendix C: Glossary 397


Index 407

TỔNG QUAN SÁCH

Python không sợ hãi sẽ là cuốn sách lý tưởng cho những người đã từng lập trình bằng bất kỳ ngôn ngữ nào trước đây—chẳng hạn như C, C++, Basic hoặc Java—và muốn học Python một cách dễ dàng và đáng tin cậy nhất có thể. Nó cũng sẽ cung cấp một hướng dẫn dễ đọc giải thích cách thức hoạt động của Python. Nói tóm lại, đây là cuốn sách Python dành cho người mới bắt đầu đến trung cấp lý tưởng.

MỤC LỤC

Preface xvii

Acknowledgments xxi

Author Bio xxiii

Chapter 1: Meet the Python 1

A Brief History of Python 1

How Python Is Different 2

How This Book Works 3

Installing Python 4

Begin Using Python with IDLE 6

Correcting Mistakes from Within IDLE 6

Dealing with Ends of Lines 7

Additional Help: Online Sources 8

Chapter 2: A Python Safari: Numbers 9

Python and Numbers 9

Python and Floating-Point Numbers 14

Assigning Numbers to Variables 17

Variable-Naming Conventions in This Book 23

Some Python Shortcuts 23

Chapter 2 Summary 26

Chapter 3: Your First Programs 29

Temperatures Rising? 29

Putting in a Print Message 35

Syntax Summaries 36

Getting String Input 41

Getting Numeric Input 43

Formatted Output String 46

Chapter 3 Summary 50

Chapter 4: Decisions and Looping 53

Decisions Inside a Computer Program 53

Conditional and Boolean Operators 55

The if, elif, and else Keywords 56

while: Looping the Loop 60

 “Give Me a break” Statement 70

Chapter 4 Summary 75

Chapter 5: Python Lists 77

The Python Way: The World Is Made of Collections 77

Processing Lists with for 80

Modifying Elements with for (You Can't!) 82

Indexing and Slicing 85

Copying Data to Slices 88

Ranges 89

List Functions and the in Keyword 97

Chapter 5 Summary 99

Chapter 6: List Comprehension and Enumeration 101

Indexes and the enumerate Function 101

The Format String Method Revisited 103

Simple List Comprehension 106

“Two-Dimensional” List Comprehension 112

List Comprehension with Conditional 114

Chapter 6 Summary 123

Chapter 7: Python Strings 125

Creating a String with Quote Marks 125

Indexing and “Slicing” 127

String/Number Conversions 130

Stripping for Fun and Profit 135

Let’s Split: The split Method 138

Building Strings with Concatenation (+) 139

The join Method 143

Chapter 7 Summary 144

Chapter 8: Single-Character Ops 147

Naming Conventions in This Chapter 147

Accessing Inpidual Characters (A Review) 148

Getting Help with String Methods 148

Testing Uppercase vs. Lowercase 149

Converting Case of Letters 150

Testing for Palindromes 151

Converting to ASCII Code 159

Converting ASCII to Character 160

Chapter 8 Summary 166

Chapter 9: Advanced Function Techniques 167

Multiple Arguments 167

Returning More Than One Value 168

Arguments by Name 173

Default Arguments 174

Importing Functions from Modules 178

Chapter 9 Summary 185

Chapter 10: Local and Global Variables 187

Local Variables, What Are They Good For? 187

Locals vs. Globals 188

Introducing the global Keyword 190

The Python “Local Variable Trap” 190

Chapter 10 Summary 204

Chapter 11: File Ops 207

Text Files vs. Binary Files 207

The Op System (os) Module 208

Open a File 211

Let’s Write a Text File 213

Read a Text File 216

Files and Exception Handling 217

Other File Modes 223

Chapter 11 Summary 224

Chapter 12: Dictionaries and Sets 227

Why Do We Need Dictionaries, Ms. Librarian? 227

Adding and Changing Key-Value Pairs 229

Accessing Values 230

Searching for Keys 231

Converting Dictionaries to Lists 235

All About Sets 241

Operations on Sets 242

Chapter 12 Summary 246

Chapter 13: Matrixes: 2-D Lists 249

Simple Matrixes 249

Accessing Elements 250

Irregular Matrixes and Length of a Row 251

Multiplication (*) and Lists 252

The Python Matrix Problem 253

How to Create N*M Matrixes: The Solution 254

How to Rotate a Matrix 261

Chapter 13 Summary 268

Chapter 14: Winning at Tic-Tac-Toe 271

Design of a Tic-Tac-Toe Board 271

Plan of This Chapter 273

Python One-Line if/else 274

The count Method for Lists 279

Introducing the Computer Player 285

Chapter 14 Summary 294

Chapter 15: Classes and Objects I 295

What’s an Object? 295

Classes in Python 296

The All-Important _ _init_ Method 301

Design for a Database Class 303

Defining Other Methods 309

Design for a Point3D Class 310

Point3D Class and Default Arguments 312

Three-Dimensional Tic-Tac-Toe 312

Chapter 15 Summary 318

Chapter 16: Classes and Objects II 321

Getting Help from Doc Strings 321

Function Typing and “Overloading” 323

Variable-Length Argument Lists 326

Inheritance 331

The Fraction Class 333

Class Variables and Methods 337

Instance Variables as “Default” Values 339

Chapter 16 Summary 344

Chapter 17: Conway’s Game of Life 347

Game of Life: The Rules of the Game 348

Generating the Neighbor Count 350

Design of the Program 352

Moving the Matrix Class to a Module 354

The Famous Slider Pattern 358

Chapter 17 Summary 364

Chapter 18: Advanced Pythonic Techniques 367

Generators 367

Exploiting the Power of Generators 369

Properties 375

Decorators: Functions Enclosing Other Functions 382

Python Decoration 385

Chapter 18 Summary 389

Appendix A: Python Operator Precedence Table 391

Appendix B: Summary of Most Important Formatting Rules for Python 3.0 393

1. Formatting Ordinary Text 393

2. Formatting Arguments 393

3. Specifying Order of Arguments 393

4. Right Justification Within Field of Size N 394

5. Left Justification Within Field of Size N 394

6. Truncation: Limit Size of Print Field 394

7. Combined Truncation and Justification 395

8. Length and Precision of Floating-Point Numbers 395

9. The Padding Character 395


Appendix C: Glossary 397


Index 407

-%
0₫ 0₫
0915920514
0915920514