jagomart
digital resources
picture1_Python Pdf 175198 | Swan Item Download 2023-01-28 05-08-14


 113x       Filetype PDF       File size 2.05 MB       Source: eecs.wsu.edu


File: Python Pdf 175198 | Swan Item Download 2023-01-28 05-08-14
algorithmic problem solving with python john b schneider shira lynn broschat jess dahmen february 22 2019 ii contents 1 introduction 1 1 1 moderncomputers 1 1 2 computerlanguages 2 1 ...

icon picture PDF Filetype PDF | Posted on 28 Jan 2023 | 2 years ago
Partial capture of text on file.
                      Algorithmic Problem Solving with Python
                     John B. Schneider     Shira Lynn Broschat      Jess Dahmen
                                          February 22, 2019
       ii
                 Contents
                 1   Introduction                                                                                        1
                     1.1   ModernComputers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .           1
                     1.2   ComputerLanguages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .           2
                     1.3   Python     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    3
                     1.4   Algorithmic Problem Solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         6
                     1.5   Obtaining Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        7
                     1.6   Running Python       . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
                           1.6.1    Interactive Sessions and Comments . . . . . . . . . . . . . . . . . . . . .          9
                           1.6.2    Running CommandsfromaFile . . . . . . . . . . . . . . . . . . . . . . .             11
                     1.7   Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     12
                     1.8   Thehelp()Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .            13
                     1.9   CommentsonLearningNewLanguages . . . . . . . . . . . . . . . . . . . . . . .                 14
                     1.10 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         15
                     1.11 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        15
                 2   CoreBasics                                                                                         19
                     2.1   Literals and Types     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   19
                     2.2   Expressions, Arithmetic Operators, and Precedence . . . . . . . . . . . . . . . . .          22
                     2.3   Statements and the Assignment Operator         . . . . . . . . . . . . . . . . . . . . . .   24
                     2.4   Cascaded and Simultaneous Assignment           . . . . . . . . . . . . . . . . . . . . . .   27
                     2.5   Multi-Line Statements and Multi-Line Strings . . . . . . . . . . . . . . . . . . . .         29
                     2.6   Identifiers and Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        30
                     2.7   NamesandNamespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .             32
                     2.8   Additional Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . .        37
                           2.8.1    Exponentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .      37
                           2.8.2    Floor Division    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   37
                           2.8.3    Moduloanddivmod() . . . . . . . . . . . . . . . . . . . . . . . . . . .             38
                           2.8.4    AugmentedAssignment . . . . . . . . . . . . . . . . . . . . . . . . . . .           40
                     2.9   Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        42
                     2.10 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        43
                     2.11 Exercises     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   49
                 3   Input and Type Conversion                                                                          51
                     3.1   Obtaining Input: input() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         51
                     3.2   Explicit Type Conversion: int(), float(), and str() . . . . . . . . . . . . .                53
                                                                    iii
                 iv                                                                                         CONTENTS
                     3.3   Evaluating Strings: eval() . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         57
                     3.4   Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        59
                     3.5   ReviewQuestions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        59
                     3.6   Exercises    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   65
                 4   Functions                                                                                          67
                     4.1   Void Functions and None . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        68
                     4.2   Creating Void Functions      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   69
                     4.3   Non-Void Functions       . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   72
                     4.4   Scope of Variables     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   76
                     4.5   Scope of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .       78
                     4.6   print()vs.return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .             79
                     4.7   Using a main() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .          81
                     4.8   Optional Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .      82
                     4.9   Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        86
                     4.10 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        87
                     4.11 Exercises     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   92
                 5   Introduction to Objects                                                                            95
                     5.1   Overview of Objects and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . .        95
                     5.2   Creating a Class: Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .     97
                     5.3   Creating a Class: Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .        99
                     5.4   Thedir()Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
                     5.5   The init ()Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
                     5.6   Operator Overloading       . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
                     5.7   Take-AwayMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
                     5.8   Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
                 6   Lists and for-Loops                                                                              109
                     6.1   lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
                     6.2   listMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
                     6.3   for-Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
                     6.4   Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
                     6.5   range() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
                     6.6   Mutability, Immutability, and Tuples . . . . . . . . . . . . . . . . . . . . . . . . . 121
                     6.7   Nesting Loops in Functions       . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
                     6.8   Simultaneous Assignment with Lists . . . . . . . . . . . . . . . . . . . . . . . . . 126
                     6.9   Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
                           6.9.1    Storing Entries in a list     . . . . . . . . . . . . . . . . . . . . . . . . . . 127
                           6.9.2    Accumulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
                           6.9.3    Fibonacci Sequence      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
                     6.10 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
                     6.11 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
The words contained in this file might help you see if this file matches what you are looking for:

...Algorithmic problem solving with python john b schneider shira lynn broschat jess dahmen february ii contents introduction moderncomputers computerlanguages obtaining running interactive sessions and comments commandsfromafile bugs thehelp function commentsonlearningnewlanguages chapter summary review questions corebasics literals types expressions arithmetic operators precedence statements the assignment operator cascaded simultaneous multi line strings identiers keywords namesandnamespaces additional exponentiation floor division moduloanddivmod augmentedassignment exercises input type conversion explicit int float str iii iv evaluating eval reviewquestions functions void none creating non scope of variables print vs return using a main optional parameters to objects overview classes class attributes methods thedir init method overloading take awaymessage lists for loops listmethods indexing range mutability immutability tuples nesting in examples storing entries list accumulators fi...

no reviews yet
Please Login to review.