# Comp 170-400 Schedule: Reading, Written Assignments, Class Activities

## Fall 2018, First 8 Weeks

This schedule is approximate. Some things may well take more or less time than projected here, particularly since this is the first tiem with these texts. Still it gives an approximation of how to divide the work up fairly evenly to not get caught being way behind at the end.

Suggested dates for finishing written work are given, though you will actually be going over the work in the next class after you finish, with me or the TA.

Assignments could still be modified or extended, so do not consider assignments official until the day I introduce them in class.

The reading assignments, labeled Text, are listed for class days. Hopefully you have finished the reading before the class and can concentrate in class on associated written work, where you can get the most help.

The multiple choice and other questions built into the text are best done as you read.

Explicitly assigned exercises, many from the ending Exercises sections in chapters, are good things to work on in class when you can get easy help. I do not include all the exercises from these final sections in your assignments. I may add some longer problems not listed in the Exercises sections. They are listed about the time you should be able to start working on them. Hopefully you are ready to go over them with me or the TA before the next ones are introduced.

8/27 Monday
8/30 Thursday
• Text: Through Ch 4. Insert after 3.1: How to be a successful programmer
• Exercises: 4.11: all but 5, though doing some of 5 may help you see the pattern for 6. (fopp 5.10 is less complete - thinkcspy better)

9/3 Monday Labor Day, no class (see Friday 9/7 makeup)

9/6 Thursday
• Text: Through Ch 7
• Exercises: 5.6: all but the one on Pi (19, the last one?) Use loops for the first two! (fopp 4.5 has only the first two)
• Exercises: thinkcspy 6.13: Use loops! Where the question just asks for a function, also call it to test it! 1-3, 6-8, 12, 13. 18 is optional if you want a challenge. fopp 12.16 #9 is another good one, with a list as a parameter.
• Exercises: 7.10: 1, 2, 3, 5, 7 (can you do it without an if-statement?), 9, 12 (can you do this without any if-statements?). (Use these thinkcspy exercises not fopp 8.12)

First pass of NEW version assuming shift off thinkcspy to fopp text from here https://runestone.academy/runestone/static/fopp/index.html

9/7 Friday makeup for Labor Day holiday
9/10 Monday
• in class: introduce PyCharm

• Text: fopp ch 14 while loops, fopp 6.6-11 more seq ops, fopp ch 9 seq transforms

• Exercises:

1. Complete and test this function:
def halving(n):

'''n is a positive integer n. Print it, and repeatedly replaces n by n // 2 and print the new value only as long as the value of n remains positive. For instance if n were 22, then the numbers 22 11 5 2 1 would be printed - each on a separate line.'''

• B. Write a program that tests a function valInRange(low, high) that prompts the user to enter a value between low and high, allowing both low and high. For as long as the user enters a number not in that range, repeat the prompt and get a new value. Stop and return the first value entered in the proper range.

• C. Rewrite the fopp 14.4 (or in thinkcspy 8.4) randomly walking turtle's isInScreen with no if statements,

• fopp 14.8 5 (or thinkcspy 8.14.5). - using problem C

• D. Write and test a function firstlast that takes a string as parameter and returns a string containing just the first and last character, if the string length is at least 2. Otherwise just return the original string.

• 9.15 #1, 2, 4

• 9.17.1

• 9.17.2 ( define a function transform(s, fromseq, toseq) that returns s transformed using fromseq and toseq strings as alphabet and key. Note that the only difference between encoding and decoding is which of fromseq and toseq are the alphabet or the key.)

9/13 Thursday
• Text:
• More Formatting
• Print with sep and end
• If you read thinkcspy ch8 for your introduction to while-loops, do read the additions in fopp ch 14.3: Listener loops, and fopp 14.5: break and continue, and my further examples in Listener Loop Variations. Break is used much more often than continue.
• fopp 10.1-8 files. Notes: In 10.3 The table first shows the one method for writing a string, not reading, next used in 10.8. You only need to be able to read with-statements in 10.6. They are handy in eliminating the need for the close function. In more advanced (not Comp 170) Python syntax with Exceptions, they are much more useful.
• fopp 11.1-12 dictionaries. Note in 11.4: The first 3 methods refer to "views". That means they actively refer to the dictionary object when they find data. If the dictionary changes, its already assigned views change to refer to the altered dictionary (in regular Python, maybe not in the browser version).
• ch 13 tuple packing,
• ch 16 sorting sections 1-3, 5 (Look back to the lambda section 15.3. They are almost always used totlly anonimously as parameter functions like here, so they are rarely named like being shown with "func =" in 15.3), 7-9
• Exercises:
• The example of break and continue in fopp 14.5 was pretty stupid. Here is a better use of break: Rewrite get_yes_or_no in fopp 14.3.1.2 with no boolean variable, with the loop heading "while(True):", and with a break statement to exit the loop.
• 10.14 all
• 11.11 #1, 2, 3
• 13.7 #1, 2
• 16.8 all
9/17 Monday
9/20 Thursday
9/24 Monday

9/27 Thursday, Project work, check finished exercises

9/29 Saturday, first team report due in luc.box.com.

10/1 Monday: project work

10/2 Tuesday, team report due in luc.box.com

10/4 Thursday: project work

10/6 Saturday, team report due in luc.box.com

10/8 Monday: No class! Mid-semester break (See Friday 10/12 makeup)

10/10 Wednesday
DUE: intermediate version of Final Team Project
10/11 Thursday