Here is the embeded link from Trinket:
My thoughts:
1. I tried to print ‘No input’ if there is no input to variables ‘hour’, ‘rate’ etc.
I searched online and find this on Stack Overflow:
http://stackoverflow.com/questions/18542107/python-test-if-raw-input-has-no-entry
Then I used the boolean operator ‘not’ to achieve that.
I also checked that ‘not’ has a higher precedence than ‘or’ through the document (part 5.15):
https://docs.python.org/2/reference/expressions.html
Or the following link neatly provide only the table:
http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html
My questions:
1. For exercise 3, for score less than 0 or greater than 10, I print ‘Bad score’ in the try part. Should that be put in except part? <\n>
I also add a comment in the Trinket file to indicate that question’s position.
Update:
This problem is solved when I do the Chapter4 Exercise.
https://github.com/silshack/spring2016/blob/gh-pages/_posts/izayak/2016-01-28-Ruotong-Ch4-Function-Exercise.md