Variable Names (Expressions and Variables)
In the More Variables exercise we used the variable names grams
, number
, and biomass
to describe the individual mass, number of individuals, and total biomass of some white-throated woodrats.
But are these variable names the best choice?
If we came back to the code for this assignment in two weeks would we be able to remember what these variables were referring to and therefore what was going on in the code?
The variable name biomass
is also kind of long.
If we had to type it many times it would be faster just to type b
.
We could also use really descriptive alternatives like individual_mass_in_grams
.
Or we would compromise and abbreviate this or leave out some of the words to make it shorter (e.g., indiv_mass_g
).*
Think about good variable names and then create a new version of this code with the variables renamed to be most useful. Make sure your code still runs properly with the name changes.
Expected outputs for Variable Names: