Fractions of hours
Write a program that converts a list of fractions of an hour into the number of milliseconds that they represent.
Your program must:
accept user input as a comma separated list of fractions, which can be expressed as either:
"x/y" - fraction
"xx.xx" - decimal
contain two functions:
parse(cs_fracstrs) - convert the comma separated string into a list of Fractions
frac_to_millis(frac) - convert a Fraction to the number of milliseconds of an hour it represents
Example
1/2, 0.2, 7/8 1800000, 720000, 3150000
Hint
There is a standard python module which will help you with your conversions. It is up to you to find it :).
不建议孩子直接抄作业啊,以下只有骨干,仅供家长参考