CompSciWeek1

Required reading for this week is Beginning Python, chapters 1-4. Be sure to try out the examples in python, not just read.

Class 1

 * 1) Pretest
 * 2) Basic Shell Usage
 * 3) * pwd, ls, directory structure
 * 4) Access to Resources
 * 5) * Logging into the lab computers
 * 6) ** Explanation of dual boot, OS evolution
 * 7) *  opening terminals, and terminals through terminals
 * 8) *  Logging into circe.rc.usf.edu
 * 9) *  Moving files
 * 10) *  Running python on your own machine
 * 11) ** Windows: Python Idle + easy_install
 * 12) ** alt: Cygwin
 * 13) ** OSX / Linux: Package managers (OSX: fink, Debian (deb): apt-get, RH (RPM): yum)
 * 14) First-order data types:
 * 15) * int(1.1), float(-3), string(4) [essentially all languages]
 * 16) * (and 2nd order) tuple([5]), list((6,)), dict([(6,7)]) [python-specific]

Class 2

 * 1) What is a Turing machine?
 * 2) The infinite loop and other control structures.
 * 3) First algorithms (Horner, Euclid, Babylonian)
 * 4) Code walk-through for a poorly designed Euclid''s algo.
 * 5) The KISS, DRY, and incremental principles
 * 6) Higher-order constructs:
 * 7) * functions
 * 8) * functional code

Homework I
This assignment will be due in 2 weeks, on Monday, Sept. 8.


 * 1) Create a program that reads in strings with raw_input until a string containing a single '.' is sent.  After that, the program should print out the strings it has read in reverse order (hint: use list.pop).
 * 2) Implement the Babylonian/Hero''s method to approximate the square root of 2 using 10 iterations.  Plot the error in the approximation against iteration number.  Is there a good way to automatically guess when to stop iterating?
 * 3) * Edit 9/5/14 A printed list of the error at each iteration can be included in place of a plot.
 * 4) Imagine Bassetts Ice Cream has a data set of daily ice cream sales for 3 different flavors stretching back to 1893.  Write pseudocode for an algorithm that finds the largest and smallest sales over daily, weekly, monthly, and yearly time-scales.  Use steps like `add together 7 days sales` and `get the smallest number in the list`.  If each test or addition step for each number takes 0.1 microseconds (10^-7 seconds), estimate how many microfortnights (1 microfortnight = 1.2096 s) the code will take to run?
 * 5) * Edit 9/5/14 One final result should be output for each timescale. For the monthly timescale, for example, the result would be the (flavor, month number) pair with the highest and lowest numbers. -- Congrats to Christine McNiff for forcing a formal specification of the result.  Ambiguities like this are a common source of conflict in programming vs. specifications...
 * 6) Obfuscation challenge: Write (in the most complicated unreadable way you can stand) a code that prints out the first 20 or so prime numbers. The code is limited to 100 lines, cannot use external packages, and must always finish running in less than 1 minute.

Answer to Bassett's Ice Cream Problem (both pseudocode and code)