Courses:

Computation for Biological Engineers >> Content Detail



Study Materials



Study Materials

Special software is required to use some of the files in this section: .py and .zip.



Python® Tutorial


Given the programming content of 20.180's assignments and the superb tutorials composed by its TAs, the class is assumed to have some experience with Python®. So, rather than offer a purely introductory tutorial to programming + Python®, the 20.181 TAs offered a short refresher course during office hours after the first lecture session.

Python®+Emacs+Shell cheat sheet (PDF)

If you still crave more Python® tutorials here is a list of 300 Python® Tutorials. You may also find the official Python® documentation to be handy.



Refresher Course on Python®/Emacs/Shell: Five Different Ways to do The Fibonacci Sequence


Code for 20.181 Refresher Course (ZIP) (The ZIP file contains: fib.txt, fib_module.py, and fibonacci_tutorial.py.)

Start with file fib_module.py. This file defines a function called calc_fib that we will use in method 1.

(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 in 20.180), the text editor on MIT server, 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.
    your changes won't be lost when you do this, but if you want to run the new version of your file, cntl-x cntl-s to save the chances before stepping out.
  • 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

Python® code written during the refresher course, with some associated comments: OH1_commentedcode.txt (TXT)


 








© 2009-2020 HigherEdSpace.com, All Rights Reserved.
Higher Ed Space ® is a registered trademark of AmeriCareers LLC.