Sichanov

metric converter

Apr 15th, 2021 (edited)
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. number = float(input())
  2. input_unit = input()
  3. output_unit = input()
  4. if input_unit == "cm":
  5.     number *= 10
  6. elif input_unit== "m":
  7.     number *= 1000
  8. if output_unit == "cm":
  9.     number /= 10
  10. elif output_unit == "m":
  11.     number /= 1000
  12.  
  13. print(f'{number:.3f}')
Add Comment
Please, Sign In to add comment