Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CoinError(ValueError):
- """"
- CoinError
- """
- coins = [
- {"ID": 1, "Symbol": "ETH", "Name": "Ether"},
- {"ID": 2, "Symbol": "SOL", "Name": "Solana"},
- {"ID": 3, "Symbol": "BTC", "Name": "Bitcoin"},
- ]
- def get_symbol(symbol):
- for coin in coins:
- if coin.get("Symbol") == symbol:
- return coin
- raise CoinError(f"Coin with symbol '{symbol}' does not exist")
Add Comment
Please, Sign In to add comment