---
author: clairewlj
layout: post
title: "Lingjie's Chapter 4 Function Exercises"
---

This is my chapter 4 funtion exercise 6-hourpay:
<iframe src="https://trinket.io/embed/python/1e68a8884e" width="100%" height="600" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

This is my chapter 4 funtion exercise 7-computegrade:
<iframe src="https://trinket.io/embed/python/1fd87b4c8f" width="100%" height="600" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

This is another program for computegrade with some differences compared with the above:
<iframe src="https://trinket.io/embed/python/e4f38176aa" width="100%" height="600" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

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.

Add Lingjie's Chapter 4 function exercises
Add Lingjie's Chapter 4 function exercises