Contents 01 Python Primer (P2-51) 02 Object-Oriented Programming(57-103) 03 Algorithm Analysis(P111-141) 04 Recursion( p150-180 05 Array-Based Sequences ( P184-224 06 Stacks, Queues, and Deques(P229-250) 07 Linked Lists(P256-294) 08Tres(P300352) 09 Priority Queues(P363-395) 10 Maps, Hash Tables, and Skip Lists(P402-452 11 Search Trees(P460-5281 12 Sorting and Selection(P537-574 13 Text Processing(P582-613) 14 Graph algorithms(P620- 686) 15 Memory Management and B-Trees(P698-717)
Contents • 01 Python Primer (P2-51) • 02 Object-Oriented Programming (P57-103) • 03 Algorithm Analysis (P111-141) • 04 Recursion (P150-180) • 05 Array-Based Sequences (P184-224) • 06 Stacks, Queues, and Deques (P229-250) • 07 Linked Lists (P256-294) • 08 Trees (P300-352) • 09 Priority Queues (P363-395) • 10 Maps, Hash Tables, and Skip Lists (P402-452) • 11 Search Trees (P460-528) • 12 Sorting and Selection (P537-574) • 13 Text Processing (P582-613) • 14 Graph Algorithms (P620-686) • 15 Memory Management and B-Trees (P698-717)
01 thon primer ·11 Python Overview 1.2 Objects in Python 1.3 Expression, Operators and Precedence 1.4 Control Flow 1,5 Functions 1.6 Simple Input and Output 1.7 Exception Handling 1.8 iterators and generators 1.9 Additional Python Conveniences 1.10 Scopes and Namespaces 1.11 Modules and Import Statement
01 Python Primer • 1.1 Python Overview • 1.2 Objects in Python • 1.3 Expression, Operators and Precedence • 1.4 Control Flow • 1.5 Functions • 1.6 Simple Input and Output • 1.7 Exception Handling • 1.8 Iterators and Generators • 1.9 Additional Python Conveniences • 1.10 Scopes and Namespaces • 1.11 Modules and Import Statement
Python The python programming language was originally developed by guido van Rossum in the early 1990s Python 2, was released in 2000, and Python 3, released in 2008 Python is an interpreted language Commands are executed through the python interpreter The interpreter receives a command, evaluates that command and reports the result of the command A programmer defines a series of commands in advance and saves those commands in a text file known as source code or a script For Python, source code is conventionally stored in a file named with the py suffix(e.g, demo.py)
Python • The Python programming language was originally developed by Guido van Rossum in the early 1990s • Python 2, was released in 2000, and Python 3, released in 2008. • Python is an interpreted language. • Commands are executed through the Python interpreter. • The interpreter receives a command, evaluates that command, and reports the result of the command. • A programmer defines a series of commands in advance and saves those commands in a text file known as source code or a script. • For Python, source code is conventionally stored in a file named with the .py suffix (e.g., demo.py)
An Example program print( "Welcome to the GPA calculator. " print('Please enter all your letter grades, one per line. ' print( 'Enter a blank line to designate the end map from letter grade to point value points={"A+:40,"A'40.-2:367,B+33B:30.B-1267 C+23c!20,c1.67,"D+133D0,"F!0.0} num_courses=0 total-points=0 done= fals while not done grade= input() read line from user if grade==I empty line was entered done= True elif grade not in points unrecognized grade entered print("Unknown grade 'tol! being ignored"format(grade) els se num_courses+=1 totaL-points + pointslgrade if num courses >0 avoid division by zero print('Your GPA is [0:. 3], format(total-points/num.courses))
An Example Program
Objects in python Python is an object-oriented language and classes form the basis for all data types Python's built-in classes the int class for integers the float class for floating-point values, the str class for character strings
Objects in Python • Python is an object-oriented language and classes form the basis for all data types. • Python’s built-in classes: • the int class for integers, • the float class for floating-point values, • the str class for character strings