Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In English class, you have likely gone through a draft-revise process You write your essay; then you sit back, maybe even print out your essay
In English class, you have likely gone through a draft-revise process You write your essay; then you sit back, maybe even print out your essay on paper, and you review your essay, looking for run-on sentences, spelling mistakes, etc. In coding, you should develop the same process We call it a code review. To begin, in this lab, we are asking you to perform a code review of your own code. Minimally, you should ensure that your code meets the posted marking rubrics for the labs and it does automated testing using the functions you defined: test_int(), test_float(), etc.. As well, for this lab, you are required to make (at least) the following two improvements. 1. For any of the values that you hard-coded (e.g. in Exercise 1, the numbers 30, 40, 50%, and 30%), replace these hard-coded values with named CONSTANTS. 2. Look at the bodies of all of your functions. Do any of them look like this? def some_function( ... ): if some_boolean_expression : return true else: return false The body contains only one if-statement the if-portion returns true (or false) and the else- portion returns the opposite. This style of programming is correct but can be simplified and shortened so that the return statement returns the calculated Boolean value directly.
def some_function( ... ): return some_boolean_expression
In wing 101
will upvote
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started