Advertisement
gr03en

Untitled

Feb 20th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. number = float(input())
  2. input_unit = input()
  3. output_unit = input()
  4.  
  5. if input_unit == "mm" and output_unit == "cm":
  6. number = number * 0.1
  7. print(f"{number:.3f}")
  8.  
  9. elif input_unit == "mm" and output_unit == "m":
  10. number = number * 0.001
  11. print(f"{number:.3f}")
  12.  
  13. elif input_unit == "cm" and output_unit == "mm":
  14. number = number * 10
  15. print(f"{number:.3f}")
  16.  
  17. elif input_unit == "cm" and output_unit == "m":
  18. number = number * 0.01
  19. print(f"{number:.3f}")
  20.  
  21. elif input_unit == "m" and output_unit == "mm":
  22. number = number * 1000
  23. print(f"{number:.3f}")
  24.  
  25. elif input_unit == "m" and output_unit == "cm":
  26. number = number * 100
  27. print(f"{number:.3f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement