Programming in Python
download syllabus
خطة المساق  
Course Description
Course Aims and objectives
Course outlines
Text book and references
Prerequisite
Grading policy
Instructors and office hours
Syllabus
Time table
Lecture Notes
Attached Files
Previous Exams
Course Description
null
Course Aims And Objective
Objective 1: Familiarization with Python?s Idle programming environment, working with values, variables, expressions and statements, programs as a sequence of statements, input-process-output program style, solving very small problems, handling errors in programs. Objective 2: Writing programs that make use of conditional execution, writing functions that return values. Objective 3: Understanding and writing recursive functions. Objective 4: Writing programs that make use of conditional and iterative execution. Objective 5: Practice with drawing shapes (computer graphics and animation). Objective 6: Practice with string operations, solving problems using string manipulation. Objective 7: Practice with creating and manipulating lists, solving problems requiring lists. Objective 8: Working with nested lists (lists of lists). Objective 9: Learning about and working with dictionaries. Objective 10: Introduce event driven Graphical User Interface (GUI) programming. Objective 11: Further work with file processing, dictionaries, and problem-solving. Objective 12: Writing programs that make use of object oriented concepts (Classes and objects, Classes and functions, Classes and methods, Overloading, Overriding, and Inheritance). ;
Course Outline
The Way of the Program
The way of the program.2. Basic concepts: program, interpreter, compiler, programming languages, solving a problem.3. What is debugging? 4. Program errors: syntax, semantic and runtime errors.5. Experimental Debugging.6. Formal and natural languages.7. The first program.
Variables, expressions, and statements
Values and Types. 2.Variables. 3.Variable Names and Keywords. 4.Python Statements. 5.Evaluating Expressions. 6.Operators and Operands. 7.Order of Operations. 8.Operations on Strings. 9.Composition. 10.Comments.
Functions
Function Calls.2.Type Conversion.3.Type Coercion.4.Math Functions.5.Composition.6.Adding New Functions.7.Function Definitions and Use.8.Flow of Execution.9.Parameters and Arguments.10.Variables and Parameters are Local.11.Stack Diagrams.12.Functions with Results.
Conditionals and Recursion
The Modulus Operator. 2. Boolean Expressions. 3. Logical Operators. 4. Conditional Execution. 5. Alternative Execution. 6. Chained Conditionals. 7. Nested Conditionals. 8. The return Statement. 9. Recursion. 10. Stack Diagrams for Recursive Functions. 11. Infinite Recursion. 12. Keyboard Input.
Fruitful Functions
Return Values. 2. Program Development. 3. Composition. 4. Boolean Functions. 5. More Recursion. Checking Types.
Iteration
Multiple Assignments. 2. The while Statement. 3. The while Statement (Drawing Iteratively). 4. The while Statement (Tables). 5. The while Statement (2D Tables). 6. Encapsulation and Generalization. 7. Local Variables. More Generalization.
Strings
A compound data type. 2. String Length. 3. Traversal and the for Loop. 4. String Slices. 5. String Comparison. 6. Strings are Immutable. 7. find Function. 8. Looping and Counting. 9. The string Module. Character Classification.
Lists
Lists. 2. List Values. 3. Accessing Elements. 4. List Length. 5. List Membership. 6. List and for Loops. 7. List Operations. 8. List Slices. 9. Lists are Mutable. 10. Lists Deletion. 11. Objects and Values. 12. Aliasing. 13. Cloning Lists. 14. List Parameters. 15. Nested Lists. 16. Matrices. 17. Strings and Lists. Drawing shapes.
Tuples
Mutability and Tuples. 2. Tuple Assignment. 3. Tuples as return Values. 4. Random Numbers. 5. List of Random Numbers. 6. Counting. Many Buckets.
Dictionaries
Dictionaries. 2. Dictionary Operations. 3. Dictionary Methods. 4. Aliasing and Copying. 5. Sparse Matrices. 6. Hints. 7. Long Integers. 8. Counting Letters. Aside.
Files and Exceptions
Files and Exceptions. 2. Text Files. 3. Writing Variables. 4. Directories. 5. Pickling. Exceptions.
GUI Programming
Graphical User Interfaces. 2. The main ideas. 3. The simplest GUI program in Python 4. Event-driven programming. 5. Terminology. 6. Changing the layout. 7. Getting input from the user. 8. GUI Examples: 9. Designing a GUI. 10. Setting up the window and widgets. 11. A variable for the Entry widget. 12. A callback for the Check button. 13. Defining the check function. 14. Improving the output. Stylistic points.
Classes and Objects
User-defined Compound Types. 2. Attributes. 3. Instances as Parameters. 4. Sameness. 5. Rectangles. 6. Instances as return values. 7. Objects are Immutable. Copying.
Classes and Functions
Time. 2. Pure Functions. 3. Modifiers.
Classes and Methods
Object-Oriented Features. 2. PrintTime. 3. Object Oriented Examples. 4. Optional Arguments. 5. The initialization method. 6. Points revisited. 7. Operator overloading. Polymorphism.
Inheritance
A simple class def: student. 2. Creating and Deleting Instances. 3. Instantiating Objects. 4. Constructor: __init__. 5. Self. 6. Deleting instances: No Need to ?free?. 7. Access to Attributes and Methods. 8. Definition of student. 9. Traditional Syntax for Access. 10. Accessing unknown members. 11. getattr(object_instance, string). 12. hasattr(object_instance,string). 13. Attributes: Two Kinds of Attributes 14. Data Attributes. 15. Class Attributes. 16. Data vs. Class Attributes. 17. Subclasses. 18. Redefining Methods. 19. Definition of a class extending student. 20. Extending __init__. 21. Built-In Members of Classes. 22. Special Methods. 23. Special Methods ? Example. 24. Special Data Items. 25. Special Data Items ? Example. Private Data and Methods.
Text book and references
 
The Main Book
Title How to Think Like a Computer Scientist (Learning with Python)
Author(s) Allen Downey, Jeffrey Elkner and Chris Meyers
Edition 2
Publisher Green Tea Press (Wellesley, Massachusetts)
 
Grading Policy
 
Activity Weight
First Exam 15
Second Exam 15
Lab Exam and Assignments 20
Final Exam 50
Instructors And Office Hours
 
The Instructors of the Course
Miscellaneous
 
Python References (Book References)
Core Python Programming by Wesley Chun is a large book at about 750 pages. The first part of the book covers the basic Python language features. The second part provides an easy-paced introduction to more advanced topics including many of those mentioned above.
 
Python References (Book References)
Python Essential Reference by David M. Beazley is a small book, but it is packed with information both on the language itself and the modules in the standard library. It is also very well indexed.
 
Python References (Book References)
Python Pocket Reference by Mark Lutz really does fit in your pocket. Although not as extensive as Python Essential Reference it is a handy reference for the most commonly used functions and modules. Mark Lutz is also the author of Programming Python, one of the earliest (and largest) books on Python and not aimed at the beginning programmer. His later book Learning Python is smaller and more accessible.
 
Python References (Internet Links References)
The Python home page at www.python.org is the place to start your search for any Python related material. You will find help, documentation, links to other sites and SIG (Special Interest Group) mailing lists that you can join.
 
Python References (Internet Links References)
The Open Book Project www.ibiblio.com/obp contains not only this book online but also similar books for Java and C++ by Allen Downey. In addition there are Lessons in Electric Circuits by Tony R. Kuphaldt, Getting down with ..., a set of tutorials on a range of computer science topics, written and edited by high school students, Python for Fun, a set of case studies in Python by Chris Meyers, and The Linux Cookbook by Michael Stultz, with 300 pages of tips and techniques.
 
Python References (Internet Links References)
Finally if you go to Google and use the search string ?python-Snake-Monty? you will get about 750,000 hits.
 
Time Table
Subject Hours
Lecture Notes
 
Lecture Notes
Chap5.ppt View
Chap14.ppt View
Chap12.ppt View
Chap7.ppt View
Inheritance.ppt View
Chap13.ppt View
Chap2.ppt View
Chap3.ppt View
Chap11.ppt View
Chap9.ppt View
Chap1.ppt View
Chap4.ppt View
Chap8.ppt View
Chap6.ppt View
Chap10.ppt View
GUI.ppt View
Attachment Files
Previous Exams
 
Previous Exams