riokorb commited on
Commit
a90da51
·
verified ·
1 Parent(s): 8c70ab9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -51,7 +51,8 @@ def convert_units(value: float, from_unit: str, to_unit: str) -> str:
51
  ('F', 'C'): lambda x: (x - 32) * 5/9
52
  }
53
  try:
54
- func = conversions[(from_unit.lower(), to_unit.lower())]
 
55
  result = func(value)
56
  return f"{value} {from_unit} = {result:.2f} {to_unit}"
57
  except KeyError:
 
51
  ('F', 'C'): lambda x: (x - 32) * 5/9
52
  }
53
  try:
54
+ key = (from_unit.strip().lower(), to_unit.strip().lower())
55
+ func = conversions[key]
56
  result = func(value)
57
  return f"{value} {from_unit} = {result:.2f} {to_unit}"
58
  except KeyError: