UserPreferences

ModelingProgrammingBasics7


Other pages: Bio/Geo/CS250, MainModelingWiki

1. Exercises

Write these functions. Test them. don't turn them in, but save them for your own future use. Save them in a textfile, and name the file something like myfunctions.py. Put that file in the same directory as whatever program you're writing (and testing and running). You can then use those functions by first importing the module (using import myfunctions and then using the functions name. If the module includes a function called factorial(num), you invoke it in your program (say, to find the factorial of 6) using myfunctions.factorial(6). (For more detailed information about modules, see "Module Coding Basics," Chapter 16 in Learning Python.)

1.1. area of a circle

1.2. distance

1.3. linear interpolation

1.4. mean

1.5. standard deviation

1.6. weighted mean

1.7. uniform deviate

1.8. normal deviate

1.9. sort

2. Assignment

No new assignment. Just finish up the last two, and start planning out your project model.

Things to think about: