Skip to content

Commit ad13a49

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5f4df3b commit ad13a49

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

web_programming/crypto_price.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111

1212
import httpx
1313

14-
COINGECKO_URL = "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd"
14+
COINGECKO_URL = (
15+
"https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd"
16+
)
17+
1518

1619
def get_eth_price_usd() -> float:
1720
"""Fetch the current ETH price in USD."""
@@ -20,10 +23,12 @@ def get_eth_price_usd() -> float:
2023
data = response.json()
2124
return data["ethereum"]["usd"]
2225

26+
2327
def eth_to_usd(eth_amount: float) -> float:
2428
"""Convert ETH amount to USD."""
2529
return eth_amount * get_eth_price_usd()
2630

31+
2732
if __name__ == "__main__":
2833
eth_amount = float(input("Enter ETH amount: "))
2934
usd_value = eth_to_usd(eth_amount)

0 commit comments

Comments
 (0)