Top Banner
Introductory Programming with Python Brendan McCane
20

Introductory Programming With Python

May 13, 2015

Download

Education

Brendan McCane

Describes a first year introductory programming course using Python and some of the student outcomes of the course.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introductory Programming With Python

Introductory Programming with

PythonBrendan McCane

Page 2: Introductory Programming With Python

Hitchhiker’s Guide to Programming

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.

Page 3: Introductory Programming With Python

Donald Knuth says:

In fact, my main conclusion after spending ten years of my life working on the TEX project is that software is hard.

Page 4: Introductory Programming With Python

CS1

• Average failure rate for CS1 courses is 33% (min 0%, max 60%).

• Most universities teach Java, C# or C++.

• Industrially relevant and OO is more “natural” right?

Page 5: Introductory Programming With Python

Design Principles

• As simple as possible

• Few magical incantations

• Immediate feedback (no compile/run cycle)

• A practical and modern language

Page 6: Introductory Programming With Python

Target Audience

• Students majoring in computer science– Python in semester 1 (optional)– Java in semester 2 (compulsory)

• Students not majoring in computer science– Mostly science or technical majors

Page 7: Introductory Programming With Python

Curriculum

• We modified an open source textbook

• How to Think Like a Computer Scientist

• You can download our version from:– http://www.cs.otago.ac.nz/staffpriv/mccane/te

aching.html

Page 8: Introductory Programming With Python

Curriculum

• Introduction• Variables, expressions• Python builtins• Functions (2)• Conditionals• More functions• Test Driven Development• Files and modules• Iteration (2)

• GUI programming• Case study (2)• Strings (2)• Lists (2)• Tuples and sets• Dictionaries• System Programming• OOP• Case study

Page 9: Introductory Programming With Python

Course Structure

• Tight integration between lectures and laboratories

• 24 lectures, 21 laboratories

• Terms requirement – students had to submit 18 labs (not marked)

• Labs had basic + advanced exercises

• Lectures were programming demonstrations

Page 10: Introductory Programming With Python

Assessment

• Mid-semester test (20%) – multi-choice

• Final Exam (60%) – multi-choice

• Mastery tests (2 x 10%)– Programming problems under test conditions– Tests published beforehand– 4 sections per test, each worth 2.5%– Each section pass/fail– Graded based on doctests + code inspection

Page 11: Introductory Programming With Python

Mastery Test Example (lab 9)

def score(numbers):

"""

give the average of the numbers excluding the biggest

and smallest one

>>> score([2, 7, 9, 10, 13, 1, 5, 12])

7.5

>>> score([3, 7, 2.5, -4])

2.75

"""

Page 12: Introductory Programming With Python

Final Exam Example

def matrix_to_sparse(in_matrix):

sparse = {}

for row_index,row in enumerate(in_matrix):

for col_index,val in enumerate(row):

if val != 0:

sparse[(row_index,col_index)] = val

return sparse

matrix = [[0,0,1], [0,2,0], [3,0,0]]

sparse = matrix_to_sparse(matrix)

print sparse[(2,0)], sparse[(1,1)], sparse[(0,2)]

Page 13: Introductory Programming With Python

Outcomes

Page 14: Introductory Programming With Python

Outcomes

• 172 students attended first lab

• 28% A

• 23% B

• 22% C

• 27% failed (19% failed terms)

Page 15: Introductory Programming With Python
Page 16: Introductory Programming With Python

Notable Comments

• Easy topics: first half

• Hard topics: second half

• Best aspect: labs

• I would like to change: “a move away from extensive use of programming”

• “F*%! Matrices”

Page 17: Introductory Programming With Python
Page 18: Introductory Programming With Python
Page 19: Introductory Programming With Python

Statistical Results

• Java with Python better than Java without (p=0.001)

• Java 2009 better than Java 2008 (p=0.0007)

• Java without Python (2009) not better than Java 2008 (p=0.18)

Page 20: Introductory Programming With Python

Conclusions

• Python is a joy to teach

• Learning Python is a good pre-cursor for learning Java

• Open source textbooks are fantastic

• Mastery tests are masterful

• Force students to attend labs