Introductory Programming With Python


Published on

Describes a first year introductory programming course using Python and some of the student outcomes of the course.

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introductory Programming With Python

  1. 1. Introductory Programming with Python Brendan McCane
  2. 2. Hitchhiker’s Guide to Programming <ul><li>Programming is hard. You just won’t believe how vastly, hugely, mind-bogglingly hard it is. I mean, you may think making a decent sandwich is hard, but that’s just peanuts to programming. </li></ul>
  3. 3. Donald Knuth says: <ul><li>In fact, my main conclusion after spending ten years of my life working on the TEX project is that software is hard. </li></ul>
  4. 4. CS1 <ul><li>Average failure rate for CS1 courses is 33% (min 0%, max 60%). </li></ul><ul><li>Most universities teach Java, C# or C++. </li></ul><ul><li>Industrially relevant and OO is more “natural” right? </li></ul>
  5. 5. Design Principles <ul><li>As simple as possible </li></ul><ul><li>Few magical incantations </li></ul><ul><li>Immediate feedback (no compile/run cycle) </li></ul><ul><li>A practical and modern language </li></ul>
  6. 6. Target Audience <ul><li>Students majoring in computer science </li></ul><ul><ul><li>Python in semester 1 (optional) </li></ul></ul><ul><ul><li>Java in semester 2 (compulsory) </li></ul></ul><ul><li>Students not majoring in computer science </li></ul><ul><ul><li>Mostly science or technical majors </li></ul></ul>
  7. 7. Curriculum <ul><li>We modified an open source textbook </li></ul><ul><li>How to Think Like a Computer Scientist </li></ul><ul><li>You can download our version from: </li></ul><ul><ul><li> </li></ul></ul>
  8. 8. Curriculum <ul><li>Introduction </li></ul><ul><li>Variables, expressions </li></ul><ul><li>Python builtins </li></ul><ul><li>Functions (2) </li></ul><ul><li>Conditionals </li></ul><ul><li>More functions </li></ul><ul><li>Test Driven Development </li></ul><ul><li>Files and modules </li></ul><ul><li>Iteration (2) </li></ul><ul><li>GUI programming </li></ul><ul><li>Case study (2) </li></ul><ul><li>Strings (2) </li></ul><ul><li>Lists (2) </li></ul><ul><li>Tuples and sets </li></ul><ul><li>Dictionaries </li></ul><ul><li>System Programming </li></ul><ul><li>OOP </li></ul><ul><li>Case study </li></ul>
  9. 9. Course Structure <ul><li>Tight integration between lectures and laboratories </li></ul><ul><li>24 lectures, 21 laboratories </li></ul><ul><li>Terms requirement – students had to submit 18 labs (not marked) </li></ul><ul><li>Labs had basic + advanced exercises </li></ul><ul><li>Lectures were programming demonstrations </li></ul>
  10. 10. Assessment <ul><li>Mid-semester test (20%) – multi-choice </li></ul><ul><li>Final Exam (60%) – multi-choice </li></ul><ul><li>Mastery tests (2 x 10%) </li></ul><ul><ul><li>Programming problems under test conditions </li></ul></ul><ul><ul><li>Tests published beforehand </li></ul></ul><ul><ul><li>4 sections per test, each worth 2.5% </li></ul></ul><ul><ul><li>Each section pass/fail </li></ul></ul><ul><ul><li>Graded based on doctests + code inspection </li></ul></ul>
  11. 11. Mastery Test Example (lab 9) <ul><li>def score(numbers): </li></ul><ul><li>&quot;&quot;&quot; </li></ul><ul><li>give the average of the numbers excluding the biggest </li></ul><ul><li>and smallest one </li></ul><ul><li>>>> score([2, 7, 9, 10, 13, 1, 5, 12]) </li></ul><ul><li>7.5 </li></ul><ul><li>>>> score([3, 7, 2.5, -4]) </li></ul><ul><li>2.75 </li></ul><ul><li>&quot;&quot;&quot; </li></ul>
  12. 12. Final Exam Example <ul><li>def matrix_to_sparse(in_matrix): </li></ul><ul><li>sparse = {} </li></ul><ul><li>for row_index,row in enumerate(in_matrix): </li></ul><ul><li>for col_index,val in enumerate(row): </li></ul><ul><li>if val != 0: </li></ul><ul><li>sparse[(row_index,col_index)] = val </li></ul><ul><li>return sparse </li></ul><ul><li>matrix = [[0,0,1], [0,2,0], [3,0,0]] </li></ul><ul><li>sparse = matrix_to_sparse(matrix) </li></ul><ul><li>print sparse[(2,0)], sparse[(1,1)], sparse[(0,2)] </li></ul>
  13. 13. Outcomes
  14. 14. Outcomes <ul><li>172 students attended first lab </li></ul><ul><li>28% A </li></ul><ul><li>23% B </li></ul><ul><li>22% C </li></ul><ul><li>27% failed (19% failed terms) </li></ul>
  15. 16. Notable Comments <ul><li>Easy topics: first half </li></ul><ul><li>Hard topics: second half </li></ul><ul><li>Best aspect: labs </li></ul><ul><li>I would like to change: “a move away from extensive use of programming” </li></ul><ul><li>“ F*%! Matrices” </li></ul>
  16. 19. Statistical Results <ul><li>Java with Python better than Java without (p=0.001) </li></ul><ul><li>Java 2009 better than Java 2008 (p=0.0007) </li></ul><ul><li>Java without Python (2009) not better than Java 2008 (p=0.18) </li></ul>
  17. 20. Conclusions <ul><li>Python is a joy to teach </li></ul><ul><li>Learning Python is a good pre-cursor for learning Java </li></ul><ul><li>Open source textbooks are fantastic </li></ul><ul><li>Mastery tests are masterful </li></ul><ul><li>Force students to attend labs </li></ul>