Kalb | Learn to Program with Python | E-Book | www2.sack.de
E-Book

E-Book, Englisch, 281 Seiten

Kalb Learn to Program with Python


1. ed
ISBN: 978-1-4842-2172-3
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

E-Book, Englisch, 281 Seiten

ISBN: 978-1-4842-2172-3
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



Get started in the world of software development: go from zero knowledge of programming to comfortably writing small to medium-sized programs in Python.  Programming can be intimidating (especially when most books on software require you to know and use obscure command line instructions) but it doesn't have to be that way!In Learn to Program with Python, author Irv Kalb uses his in-person teaching experience to guide you through learning the Python computer programming language. He uses a conversational style to make you feel as though he is your personal tutor. All material is laid out in a thoughtful manner, each lesson building on previous ones. Many real-world analogies make the material easy to relate to. A wide variety of well-documented examples are provided.  Along the way, you'll develop small programs on your own through a series of coding challenges that reinforce the content of the chapters.

What You Will Learn:  Learn fundamental programming concepts including: variables and assignment statements, functions, conditionals, loops, lists, strings, file input and output, Internet data, and data structures
Get comfortable with the free IDLE Interactive Development Environment (IDE), which you will use to write and debug all your Python code - no need to use the command line!
Build text-based programs, including a number of simple games
Learn how to re-use code by building your own modules
Use Python's built-in data structures and packages to represent and make use of complex data from the Internet

Who this book is for:This book assumes that you have absolutely no prior knowledge about programming. There is no need to learn or use any obscure Unix commands. Students of any age who have had no exposure to programming and are interested in learning to do software development in the Python language. The book can be used as a text book associated with a high school or college introduction to computer science course.  Secondly, people who have had exposure to some computer language other than Python, who would like to build good habits for programming in Python.

Irv Kalb has a BS and MS in Computer Science.  He has worked as a software developer, manager of software developers, manager of software development projects, and as a teacher of software for entire career.  He has worked both as an employee for a number of technical companies and for many years as an independent consultant.  He has been developing been writing technical articles and ebooks about software since 2000, and has been teaching software development in Silicon Valley colleges since 2010.

Kalb Learn to Program with Python jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


1;Contents at a Glance;6
2;Contents;8
3;About the Author;18
4;About the Technical Reviewer;20
5;Acknowledgments;22
6;Chapter 1: Getting Started;23
6.1;Welcome;23
6.2;What Is Python?;23
6.3;Installing Python;24
6.4;IDLE and the Python Shell;24
6.5;Hello World;25
6.6;Creating, Saving, and Running a Python File;26
6.7;IDLE on Multiple Platforms;28
6.8;Summary;28
7;Chapter 2: Variables and Assignment Statements;29
7.1;A Sample Python Program;30
7.2;The Building Blocks of Programming;31
7.3;Four Types of Data;32
7.3.1;Integers;32
7.3.2;Floats;32
7.3.3;Strings;32
7.3.4;Booleans;33
7.3.5;Examples of Data;33
7.3.6;Form with Underlying Data;34
7.4;Variables;35
7.5;Assignment Statements;38
7.6;Variable Names;40
7.6.1;Naming Convention;41
7.6.2;Keywords;42
7.6.3;Case Sensitivity;43
7.6.4;More Complicated Assignment Statements;43
7.7;Print Statements;44
7.8;Simple Math;46
7.9;Order of Operations;48
7.10;First Python Programs;49
7.11;Shorthand Naming Convention;50
7.12;Adding Comments;52
7.12.1;Full-Line Comment;52
7.12.2;Add a Comment After a Line of Code;52
7.12.3;Multiline Comment;52
7.13;Whitespace;53
7.14;Errors;54
7.14.1;Syntax Error;54
7.14.2;Exception Error;55
7.14.3;Logic Error;56
7.15;Summary;56
8;Chapter 3: Built-in Functions;57
8.1;Overview of Built-in Functions;57
8.2;Function Call;58
8.3;Arguments;58
8.4;Results;58
8.5;Built-in type Function;58
8.6;Getting Input from the User;60
8.7;Conversion Functions;61
8.7.1;int Function;61
8.7.2;float Function;61
8.7.3;str Function;61
8.8;First Real Programs;62
8.9;Concatenation;64
8.10;Another Programming Exercise;65
8.11;Using Function Calls Inside Assignment Statements;67
8.12;Summary;68
9;Chapter 4: User-Defined Functions;69
9.1;A Recipe as an Analogy for Building Software;70
9.1.1;Ingredients;70
9.1.2;Directions;70
9.2;Definition of a Function;72
9.3;Building Our First Function;73
9.4;Calling a User-Defined Function;73
9.5;Receiving Data in a User-Defined Function: Parameters;75
9.6;Building User-Defined Functions with Parameters;76
9.7;Building a Simple Function that Does Addition;78
9.8;Building a Function to Calculate an Average;79
9.9;Returning a Value from a Function: The return Statement;79
9.10;Returning No Value: None;81
9.11;Returning More Than One Value;81
9.12;Specific and General Variable Names in Calls and Functions;82
9.13;Temperature Conversion Functions;83
9.14;Placement of Functions in a Python File;84
9.15;Never Write Multiple Copies of the Same Code;84
9.16;Constants;86
9.17;Scope;86
9.18;Global Variables and Local Variables with the Same Names;89
9.19;Finding Errors in Functions: Traceback;90
9.20;Summary;92
10;Chapter 5: if, else, and elif Statements;93
10.1;Flowcharting;94
10.2;The if Statement;96
10.3;Comparison Operators;98
10.4;Examples of if Statements;98
10.5;Nested if Statement;99
10.6;The else Statement;100
10.7;Using if/else Inside a Function;102
10.8;The elif Statement;102
10.9;Using Many elif Statements;104
10.10;A Grading Program;106
10.11;A Small Sample Program: Absolute Value;106
10.12;Programming Challenges;108
10.12.1;Negative, Positive, Zero;108
10.12.2;isSquare;110
10.12.3;isEven;113
10.12.4;isRectangle;115
10.13;Conditional Logic;116
10.14;The Logical not Operator;117
10.15;The Logical and Operator;117
10.16;The Logical or Operator;118
10.17;Precedence of Comparison and Logical Operators;119
10.18;Booleans in if Statements;120
10.19;Program to Calculate Shipping;120
10.20;Summary;123
11;Chapter 6: Loops;124
11.1;User’s View of the Game;125
11.2;Loops;126
11.3;The while Statement;127
11.4;First Loop in a Real Program;129
11.5;Increment and Decrement;130
11.6;Running a Program Multiple Times;131
11.7;Python Built-in Packages;132
11.8;Generating a Random Number;133
11.9;Simulation of Flipping a Coin;134
11.10;Other Examples of Using Random Numbers;135
11.11;Creating an Infinite Loop;136
11.12;A New Style of Building a Loop: while True, and break;137
11.13;The continue Statement;139
11.14;Asking If the User Wants to Repeat: the Empty String;141
11.15;Pseudocode;141
11.16;Building the “Guess the Number” Program;142
11.17;Playing a Game Multiple Times;146
11.18;Error Checking with try/except;148
11.19;Building Error-Checking Utility Functions;150
11.20;Coding Challenge;151
11.21;Summary;153
12;Chapter 7: Lists;154
12.1;Collections of Data;155
12.2;Lists;155
12.3;Elements;156
12.4;Python Syntax for a List;156
12.5;Empty List;157
12.6;Position of an Element in a List: Index;157
12.7;Accessing an Element in a List;158
12.8;Using a Variable or Expression as an Index in a List;159
12.9;Changing a Value in a List;161
12.10;Using Negative Indices;161
12.11;Building a Simple Mad Libs Game;162
12.12;Adding a List to Our Mad Libs Game;163
12.13;Determining the Number of Elements in a List: The len Function;164
12.14;Programming Challenge 1;165
12.15;Using a List Argument with a Function;167
12.16;Accessing All Elements of a List: Iteration;168
12.17;for Statements and for Loops;169
12.18;Programming Challenge 2;171
12.19;Generating a Range of Numbers;172
12.20;Programming Challenge 3;173
12.21;Scientific Simulations;175
12.22;List Manipulation;178
12.23;List Manipulation Example: An Inventory Example;179
12.24;Pizza Toppings Example;180
12.25;Summary;184
13;Chapter 8: Strings;185
13.1;len Function Applied to Strings;186
13.2;Indexing Characters in a String;186
13.3;Accessing Characters in a String;187
13.4;Iterating Through Characters in a String;188
13.5;Creating a Substring: A Slice;190
13.6;Programming Challenge 1: Creating a Slice;191
13.7;Additional Slicing Syntax;193
13.8;Slicing As Applied to a List;194
13.9;Strings Are Not Changeable;194
13.10;Programming Challenge 2: Searching a String;195
13.11;Built-in String Operations;196
13.12;Examples of String Operations;198
13.13;Programming Challenge 3: Directory Style;198
13.14;Summary;200
14;Chapter 9: File Input/Output;201
14.1;Saving Files on a Computer;202
14.2;Defining a Path to a File;202
14.3;Reading from and Writing to a File;204
14.4;File Handle;205
14.5;The Python os Package;206
14.6;Building Reusable File I/O Functions;206
14.7;Example Using Our File I/O Functions;207
14.8;Importing Our Own Modules;208
14.9;Saving Data to a File and Reading It Back;210
14.10;Building an Adding Game;212
14.11;Programming Challenge 1;212
14.12;Programming Challenge 2;213
14.13;Writing/Reading One Piece of Data to and from a File;216
14.14;Writing/Reading Multiple Pieces of Data to and from a File;217
14.15;The join Function;217
14.16;The split Function;218
14.17;Final Version of the Adding Game;219
14.18;Writing and Reading a Line at a Time with a File;221
14.19;Example: Multiple Choice Test;223
14.20;A Compiled Version of a Module;228
14.21;Summary;228
15;Chapter 10: Internet Data;229
15.1;Request/Response Model;229
15.2;Request with Values;231
15.3;Example URL: Getting a Stock Price;231
15.4;Pretending to Be a Browser;232
15.5;API;233
15.6;Example Program to Get Stock Price Information Using an API;234
15.7;Example Program to Get Exchange Rate Information;236
15.8;Example Program to Get Powerball Information;239
15.9;API Key;243
15.10;URL Encoding;243
15.11;Summary;245
16;Chapter 11: Data Structures;246
16.1;Tuple;247
16.2;Lists of Lists;249
16.3;Representing a Grid or a Spreadsheet;250
16.4;Representing the World of an Adventure Game;250
16.5;Reading a Comma-Separated Value (.csv) File;253
16.6;Dictionary;257
16.7;Using the in Operator on a Dictionary;259
16.8;Programming Challenge;260
16.9;A Python Dictionary to Represent a Programming Dictionary;261
16.10;Iterating Through a Dictionary;262
16.11;Combining Lists and Dictionaries;263
16.12;JSON: JavaScript Object Notation;265
16.13;Example Program to Get Weather Data;267
16.14;XML Data;269
16.15;Accessing Repeating Groupings in JSON and XML;272
16.16;Summary;274
17;Chapter 12: Where to Go from Here;275
17.1;Python Language Documentation;275
17.2;Python Standard Library;275
17.3;Python External Packages;276
17.4;Python Development Environments;277
17.5;Places to Find Answers to Questions;277
17.6;Projects and Practice, Practice, Practice;278
17.7;Summary;278
18;Index;279



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.