Standard form (a.k.a. standard index form), is a system of writing numbers which is particularly useful when using either very large or very small numbers. It is based on using powers of 10 to express how big or small a number is.
Standard form is written in the form of a x 10n, where is a number between 1 and 10 (bigger than or equal to 1 but strictly lower than 10). For large numbers, n is a positive whole number, whereas for small numbers, n is negative whole number.
The standard form is for instance used by astronomers as the distance between stars is very high, resulting in numbers which are not easy to write down and memorise without using the standard form. For instance did you know that Alpha Centauri was the second nearest planet (after the Sun) to planet Earth. It is located 4.37 light-years away from the Sun. Considering that a light-year is the distance travelled by light in one year and knowing that light travels at 300,000 km per second we can work out the distance in km between Alpha Centauri and the Sun as follows:
In standard form:
Similarly, physicists and chemists use the standard form when using very small numbers. For instance, the size of a molecule of water (H2O) is about 0.27 of a nanometer.
In standard form:
Our aim is to write a procedure that takes a number as a parameter and outputs this number in standard form. To do so, our procedure will be based on the following algorithm:
Complete the python code using the trinket below:
All done? It’s now time to test your code to see if it works as expected.
|Test #||Input Values||Description||Expected Output||Actual Output|
|#1||41400000000000||The distance (in km) between the Sun and Alpha Centauri|
|#2||0.00000000027||The size (in meters!) of a molecule of water.|
|#3||5972000000000000000000000||The mass (in kg) of planet Earth|
|#4||1898000000000000000000000000||The mass (in kg) of Jupiter|