I am teaching a course "Introduction to Computer Programming" to the first year math students. One has to assume that this is the first exposure of students to computer programming. Here are the main goals of my teaching:
- Students should learn and understand the basics of Python.
- Eventually they need to master sufficiently many Python tools so that they are able to select the right tool for a given problem.
- At the same time they have to learn basic skills of problem solving by computer programming.
My method of teaching is to give for each newly introduced concept a series of problems and teasers that motivate students. For instance, when introducing strings and lists a natural question is the task of string or list reversal. If I ask students to write a code that will check whether a string is a palindrome then I better tell them how to reverse it.
For lists, a natural solution myString.reverse()
has at least two drawbacks:
- It does not carry over to strings.
- Students will see it a magic unless told about methods first.
The real question is: How should one introduce the problem of reversing a string in Python?