how do you code in python?
Earthquakes are measured using the Richter scale, but what do those numbers actually mean? How much force is in a 5.5 earthquake? In this program, you are going to convert the Richter scale value of a hypothetical earthquake to Joules (to measure its energy) then to what those Joules are equivalent to for comparison: - The earthquake's energy equivalent in metric tons of exploded TNT; - Approximately how many 1883 Krakatoa volcano eruptions the earthquake is equivalent to; and - Approximately how many Hiroshima bombs the earthquake is equivalent to. Constants for Conversion - The energy released in joules (which, by the way, represents the work done on an object when a force of 1 newton acts on that object) for a particular Richter scale, R, can be calculated as follows: 10(1.5?R+4.8)J; - 1 metric ton of exploded TNT yields 4.184?109 J : - The 1883 Krakatoa volcanic eruption released 8?1017 J of energy; and - The Little Boy atomic bomb dropped on Hiroshima in World War II released 6.3?1013 J of energy. Specifications - Prompt the user for input "The earthquake's magnitude on the Richter scale:" and accept the input as a float. - If the user inputs a value less than 0 or greater than 13 , display the appropriate output as shown in the sample outputs. - Output how many joules that equals. - Output the equivalence in TNT explosions, Krakatoa eruptions, and Hiroshima bombings. - All output should have 4 decimal place precision and use commas appropriately. Constraints - You must have at least one subroutine; - Your output must be exactly the same as the output of the sample runs shown below; - You must comment your source code appropriately, include an informative header at the top, and use good coding style; - You must use meaningful variable names; - When displaying output, use the string format() function with string format specifiers.
Sample run 1 The earthquake's magnitude on the Richter scale: 1.0 A 1.0000 magnitude earthquake releases 1,995,262.3150 joules of energy. This is equivalent to 0.0005 metric tons of exploded TNT. This is equivalent to 0.0000 Krakatoa eruptions and 0.0000 Hiroshima bombs. Sample run 2 The earthquake's magnitude on the Richter scale: 5.0 A 5.0000 magnitude earthquake releases 1,995,262,314,968.8828 joules of energy. This is equivalent to 476.8791 metric tons of exploded TNT. This is equivalent to 0.0000Krakatoa eruptions and 0.0317 Hiroshima bombs. Sample run 3 The earthquake's magnitude on the Richter scale: 9.5 A 9.5000 magnitude earthquake releases 11,220,184,543,019,653,120.0000 joules of energy This is equivalent to 2,681,688,466.3049 metric tons of exploded TNT. This is equivalent to 14.0252 Krakatoa eruptions and 178,098.1673 Hiroshima bombs. Sample run 4 The earthquake's magnitude on the Richter scale: ?3.6 Enter a positive value from 0 till 13. Sample run 5 The earthquake's magnitude on the Richter scale: 23.16 Enter a positive value from 0 till 13 ,