DekGenius.com
[ Team LiB ] Previous Section Next Section

28.5 Exercises

Most of the topics this chapter are not really good topics for exercises without first covering the frameworks they cover. A couple of things can be done with the knowledge you already have, however:

See Section B.8.2 for the solutions.

  1. Faking the Web. You may not have a web server running, which makes using formletter.py and FormEditor.py difficult, since they use data generated by the CGI script. As an exercise, write a program that creates files with the same properties as those created by the CGI script.

  2. Cleaning up. There's a serious problem with the formletter.py program: namely, if, it's run nightly, any complaint is going to cause a letter to be printed. That will happen every night, since there is no mechanism for indicating that a letter has been generated and that no more letters need be generated regarding that specific complaint. Fix this problem.

  3. Adding parametric plotting to grapher.py. Modify grapher.py to allow the user to specify expressions that return both x and y values, instead of the current just y solution. For example, the user should be able to write in the Expression widget: sin(x/3. 1),cos(x/6.15) (note the comma: this is a tuple!) and get a picture like that shown in Figure 28-7.

Figure 28-7. Output of Exercise 3
figs/lpy2_2807.gif
    [ Team LiB ] Previous Section Next Section