Put the lesson Variables and Data Types into practice by writing a program yourself.
An aluminium block has a mass of 27.0 grams and a volume of 10.0 cm³. Density is mass divided by volume.
Store the values in variables, calculate the density, and print it. Then print the data type of the result.
mass, volume and density.Density: 2.7 g/cm³, using round() to round the density to 2 decimal places.density.Density: 2.7 g/cm³ <class 'float'>
Write your program below and press Run. Each run is checked against the expected output.
Press Run to see what your program prints.
One possible solution. Other programs that print the same output are correct too.
mass = 27.0 # gramsvolume = 10.0 # cm³density = mass / volumeprint("Density:", round(density, 2), "g/cm³")print(type(density))