Mac McPherson wrote:
And when I ran my code I only got the perimeter for the third line (20.72 three times). How would I go about making sure it reads all of the input data. Here is the code I have so far
Junilu Lacar wrote:This code is redundant:
The code from lines 25-27 can be reduced to a single line of code without loss of clarity. Hint: the return statement can be followed by an expression and the value returned will be the value obtained after the expression is completely evaluated.
For example:
Junilu Lacar wrote:By redundant, I meant that there were lines of code that you could eliminate. I didn't mean that you could eliminate the entire method. With the example code that I gave, the redundant version would have been:
Do you see the similarity to what you wrote? You only need one line of code to do the same thing. It may seem trivial but you want to write code that's concise and to-the-point.