Chapter 1 - Syntax Basics
Exercise 1: Fill in the Blanks
The program below should take a number of cans of food and calculate their total weight. It should declare a
count variable with the number of cans, and a
unitWeight variable with the amount (in kilograms) that each can weighs. It should then multiply
unitWeight, and assign the result to a new
totalWeight variable. Finally, it should print the number of cans and their total weight.
Fill in the blanks in the program so that it will run and produce the specified output. Note that
count will have a type of
unitWeight will have a type of
float64, so you’ll need to do a conversion before you can multiply the two together.
20 cans weigh 8 kilograms