Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
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:
|