Calculate a total weight in pounds of 20 bushels of soybeans and then convert it to kilograms. The total weight is simply the sum of the weight of all 20 bushels, but in this case we know that the weight of one bushel of soybeans is 60 pounds.
bushel
and assign it the mass of a single bushel.bushels
and assign it the number of bushels.bushel_tot
and assign it a value by multiplying the two variables together.bushel_tot
into kilograms and assign this value to a new variable.Think about the choice of variable names. If we came back to the code for this assignment in two weeks
(without the assignment itself in hand) would we be able to remember
what these variables were referring to and therefore what was going on
in the code? The variable name bushel
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
bushel_weight_in_pounds
. Or we would compromise and abbreviate
this or leave out some of the words to make it shorter (e.g.,
bshl_lbs
).
Think about appropriate variable names and then rename the variables in your program to what you find most useful.
[click here for output]