kalekarnn commited on
Commit
8cffc76
·
verified ·
1 Parent(s): 55f6d8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -18,11 +18,10 @@ def crypto_currency_price(coin_name: str) -> str:
18
  endpoint = f"https://api.coincap.io/v2/assets/{coin_name}"
19
  response = requests.get(endpoint)
20
  result = response.json()
21
-
22
  if "data" in result and "priceUsd" in result["data"]:
23
  price = float(result["data"]["priceUsd"])
24
  formatted_price = f"${price:.2f}"
25
- return formatted_price
26
  return f"No price found for {coin_name}"
27
  except Exception as e:
28
  return f"Error fetching currency price for '{coin_name}': {str(e)}"
 
18
  endpoint = f"https://api.coincap.io/v2/assets/{coin_name}"
19
  response = requests.get(endpoint)
20
  result = response.json()
 
21
  if "data" in result and "priceUsd" in result["data"]:
22
  price = float(result["data"]["priceUsd"])
23
  formatted_price = f"${price:.2f}"
24
+ return f"The current price of {coin_name} is {formatted_price} USD"
25
  return f"No price found for {coin_name}"
26
  except Exception as e:
27
  return f"Error fetching currency price for '{coin_name}': {str(e)}"