Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A rectangle is long and wide. Store the length and the width in variables and show the area.
Store the numbers in variables, then use the names in the sum.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. Area is length times width.
length = 12.5 and width = 4area = length * widthprint("Area:", area)Check. . The program shows 50.0, because one number is a float. The unit is square metres.
Log in to join the discussion.
Loading…