Did you know?
Archimedes is one of the most famous physicist, mathematician, astronomer and inventor of the classical age: He lived in Syracuse on the island of Sicily in the third century B.C. Many of his inventions and theories are still being used today.
This Python challenge will be based on Archimedes’ most famous “Eureka!” moment: At the time, Hiero, The King of Syracuse (Sicily, Italy), had given his goldsmith some pure gold and asked him to make a crown out of this gold. On reception of the crown, Hiero suspected he had been cheated by the goldsmith. He believe the goldsmith had replaced some of the pure gold with the same weight of silver. However Hiero needed to be able to prove that his suspicion was correct and that the crown was not made of pure gold.
Knowing the weight/mass of the crown was not enough to confirm whether the crown was made of pure gold (as opposed to a mix of gold and silver). However if Archimedes knew that if he could accurately measure the volume of the crown, he could work out its density. (Density = mass / volume). He could then compare this density with the density of pure gold to see if they are the same. If not, this would be the proof that the crown is not just made of pure gold which would confirm Hiero’s suspicion. The issue was that, though it was easy at the time to precisely measure the mass of an object, there was no method for working out the exact volume of an irregular object (such as a crown!).
It’s while stepping into a bath that Archimedes noticed that the water level rose: he immediately deducted that the volume of water displaced must be equal to the volume of the part of his body he had submerged. He then realised that the volume of irregular objects could be measured with precision using this submersion approach. He is said to have been so eager to share his discovery that he leapt out of his bathtub and ran naked through the streets of Syracuse shouting Eureka! Eureka! (Greek for “I have it!”).
By applying this approach to the golden crown, Archimedes was able to get an accurate measure of the volume of the crown and could hence calculate the density of the crown which effectively turned out to be of a lesser density than pure gold. This confirmed Hiero’s suspicion that his goldsmith had stolen some of the pure gold he was given to make this crown!
In this Python challenge we will use a program to help identify the density of an object and compare with the known density of different metals such as gold, silver, bronze, etc.
Our algorithm will:
- Ask the user to enter the mass of an object. (in Kg)
- Ask the user to enter the volume of an object. (in m3)
- Calculate and output the density of this object (mass/volume)
- Compare this density with the densities of different metals such as pure gold, silver and bronze and output the corresponding metal if there is a match.
Our algorithm will use the following data:
|Aluminium||Between 2400 kg/m3 and 2700 kg/m3|
|Bronze||Between 8100 kg/m3 and 8300 kg/m3|
|Silver||Between 10400 kg/m3 and 10600 kg/m3|
|Lead||Between 11200 kg/m3 and 11400 kg/m3|
|Gold||Between 17100 kg/m3 and 17500 kg/m3|
|Platinum||Between 21000 kg/m3 and 21500 kg/m3|
Complete the code below and use your code to work out what the following four crowns are made of…
|Test #||Object||Input Values||Output|
Volume: 54cm3 = 0.000054m3
Volume: 70cm3 = 0.00007m3
Volume: 65cm3 = 0.000065m3
Volume: 71cm3 = 0.000071m3
You will need to complete the code provided below: