All problems

The Mixed Units Column

mediumPythonData CleaningStrings

Ashford Freight weighs pallets at two depots and the depots disagree about units: one records a pallet as 12kg, the other records the same pallet as 12000g, and both feed the same column. Billing cannot total a shipment until every weight is in kilograms. The unit is written on the end of each value with no space in front of it.

Task: Print every weight converted to kilograms.

Input

The first line holds one integer n, how many weights follow. Each of the next n lines holds one weight: a number, which may carry a decimal point, immediately followed by either kg or g with nothing between them.

Output

n lines in the same order, each holding that weight in kilograms with exactly two digits after the decimal point.

Example:

Input:
3
12kg
500g
2.5kg

Output:
12.00
0.50
2.50

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…