Lingjie's Chapter 4 Function Exercises

by Lingjie Wang

27 Jan 2016

This is my chapter 4 funtion exercise 6-hourpay:

This is my chapter 4 funtion exercise 7-computegrade:

This is another program for computegrade with some differences compared with the above:

Reflection: During the process of working on exercise 7, I realized that when I wanted to add the conditional execution of try-except to the function, the print part could be a problem if I did not also return the value of the message such as “Please enter a numeric number”. Then I learned that “return” could also be used for string type, so I finally also returned these sentences in the function. And I also has a question that is it better to put sentences in the function area as many as possible instead of putting them in the program? That’s why I posted two programs for exercise 7.

Lingjie Wang is a first year master student studying Statistics and Operations Research Find Lingjie Wang on Twitter, Github, and on the web.