tigerstride commited on
Commit
61dca5d
·
verified ·
1 Parent(s): 3730ec5

Update app.py

Browse files

Restrict input to C or F for the conversion

Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -18,8 +18,10 @@ def celcius_tool(convertTo:str, temperature:int)-> str: #it's important to speci
18
  """
19
  if convertTo == "F":
20
  return f"Temperature {temperature} degrees in Fahrenheit is {(temperature * 1.8) + 32}"
21
- else:
22
  return f"Temperature {temperature} degrees in Celsius is {(temperature - 32) * 5/9}"
 
 
23
 
24
  @tool
25
  def get_current_time_in_timezone(timezone: str) -> str:
 
18
  """
19
  if convertTo == "F":
20
  return f"Temperature {temperature} degrees in Fahrenheit is {(temperature * 1.8) + 32}"
21
+ elif convertTo == "C":
22
  return f"Temperature {temperature} degrees in Celsius is {(temperature - 32) * 5/9}"
23
+ else:
24
+ return f"ERROR convertTo must be either C or F"
25
 
26
  @tool
27
  def get_current_time_in_timezone(timezone: str) -> str: