Advertisement
simeonshopov

Metric convertor

Sep 16th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. number = float(input())
  2. vhod = input()
  3. izhod = input()
  4.  
  5. if vhod == "m":
  6.   if izhod == "cm":
  7.     result = number*100
  8.   elif izhod == "mm":
  9.     result = number*1000
  10.  
  11. if vhod == "cm":
  12.   if izhod == "m":
  13.     result = number/100
  14.   elif izhod == "mm":
  15.     result = number*10
  16.  
  17. if vhod == "mm":
  18.   if izhod == "cm":
  19.     result = number/10
  20.   elif izhod == "m":
  21.     result = number/1000
  22.  
  23. print(f"{result:.3f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement