Ss_2015_post_mortem.doc

June 20, 2015  Harry Baya

I just completed teaching two sections of “Introduction to Programming” at the Emory & Henry Summer Scholars week.  All things considered, I think it went well.  However, I want to make some notes about what, at the moment, I think I would do differently.

I discovered on Thursday that the students did not really know how to work with If statements or loops on their own.  This was somewhat upsetting and depressing to me as I had thought they had mastered these and were learning all the new things I was teaching.  

If I teach this class again, I should spend far more time on If and loops.  Here is one plan.  I think it might be good to make up a tentative set of lists of daily exercises and put them on the web site as sequential assignments.  I might want to make a similar list of binary/other base number, exercises.

Every day we will spend some time in the idle shell working with If and loop statements before going on to the exercises they will do on their own.

Every day, including the first day, I will give them a series of simple exercises to do and will spend as much of the class as needed to have all of them get through the basic exercises.  The goal is that they will be able to do these exercises without my help.

There will be a page, slightly different each day, with a list of exercises.  The required ones will be the first 3 to 5 ( or whatever I choose).   The remaining ones will be for the students who get through the required ones with time to spare.   Here are the kinds of exercises I have in mind:

Some of these exercises will  use functions I have written.  They will copy these functions from a page displayed on the screen and paste them into their program. These functions may use things they have not learned, such as lists, random numbers, and even user input.

In the process I  would like to require them to use, repeatedly, all of the arithmetic functions and all the comparison functions, including the % operator

·       I would also like them to use:

·       Nested if statements

·       Nested loops

·       If statements within loops

·       Loops within if statements

“If” statements:

Given two numbers, print out the large one.

Given two names and associated ages, write a story about each person referring to their names and ages.   The ages will be picked at random by a function I will have them copy.    I can tell them what the two ages are, but not which character is which age.

Given three numbers, find the largest one.

Copy a function that picks a name at random from a list.  Use that function to determine the name of the crook.   Then write a program to determine which one of several names this name matches.  I.e. Who did it!  They make up the statement that describes the crime, or action of the individual.   The idea is that they will have to use if statements to match the unknown name with the possible names.

[ I’m sure I can come up with many more ]

“While” loops:

Write a loop to print the numbers from 0 to 10

Write a loop to print the numbers from 5 to 12

Write a loop to print the numbers from 10 down to  9

Write a loop to find the sum of the numbers from 1 to 15

Write a loop to find the result of multiply all the numbers between 1 and 8 times each other

Write a loop to find the of the squares of the even numbers between 3 and 11.

Write a program to find the result of dividing the sum of the numbers from 1 to 22 by the sum of the nmbers between 3 and  9.   You will need two loops for this.

For each number between 7 and  23 write out the sum of the digits from 1 to up to that number.  You will need a loop inside a loop for this.

Write a loop to print the odd numbers between 1 and 11

Write a loop to print the even numbers between 3 and 25

Write a loop to find those numbers between 1 and 1000 that are evenly divisible by 17.

Write a loop to display the number 7 raised to powers from 0 to 5

Wirte a loop to display the the result of dividing 17 raised to powers from 3 to 8 divided by 13 raised to the same power

Write a loop print numbers from  - 10 to 10

Write a loop to print the numbers from 7 to 36 all on the same line.

Write a loop to print the values of 2 raised to the powers of  0 to 8.

Wite a loop to print the values of  2 raised to powers from 0, 1, 2 ..etc. up till the result is greater than 256.

Write a program to find the roots (i.e square root, cube root etc… n**(1/2), n**(1/3)  etc. ) of 256 until the result is less than 2.

 

[make up more ]

Once I am satisfied that they have “mastered” loops and if statements, if that happens, I will introduce lists.

Along the way I MAY introduce random numbers and user input, but always within the context of If statements and loops.

“For” Loops:

Hold off on this till while loops and if statements are clearly mastered.

Use a for loop to list all the numbers between -3 and 5

Use a for loop to list the number 16  raised to the power of all the numbers between -3 and 3

For loops using ranges , incuding ( n), (n1,n2), (-n1,-n2), (-n1, n2), (,n1)   and computed, or random, numbers for n1 and n2 within chosen ranges.

Later topics   IF we get this far:

Lists

User input

Input and output to a file

Dictionaries