20.181:Materials:OH1 notes

From OpenWetWare
Revision as of 09:30, 8 September 2006 by SoniaT (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

(Python/Emacs/Shell refresher tutorial)

Five different ways to do the fibonacci sequence...

Downloaded some code off the web: fib_module.py

This file defines a function called calc_fib that we will use.

(In this class we will often start with a big code base that someone else has developed, and we will write some small part which utilizes this pre-existing code. When you are supposed to hijack others' code, you will be told to do so explicitly and the code will be provided to you. In all other cases, using code you found on the internets is not acceptable. So please don't.)

For this tutorial we'll be working on emacs. Emacs is like pico (which you used last term), the text editor on athena, except with more functionality. But you can use whichever you're comfortable with. A few additional emacs tips:

  • cntl-Z to step out of emacs without killing it, then type "fg" (stands for foreground) to step back in.
  • emacs find and replace function
    • M-% (alt-shift-5)
    • you have to have your cursor at the top of the file
    • space bar to accept change and keep finding
    • more info on find and replace