Bitcoin price alert system KEYerror

Hello, I am facing an KEY error while executing the python code for bitcoin alert system
HERE’S THE CODE


HERE’S THE OUTPUT

hi @rajputsafal27
try this code : url= “https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms={}".format("currency.upper”)

You could also check this documentation for formatting the URL string to include your input.
Also I think you have missed the ‘&t’ in the URL.
Hope this works!

Here is the document for reference: https://www.datacamp.com/community/tutorials/python-string-format?utm_source=adwords_ppc&utm_campaignid=1455363063&utm_adgroupid=65083631748&utm_device=c&utm_keyword=&utm_matchtype=b&utm_network=g&utm_adpostion=&utm_creative=278443377095&utm_targetid=aud-392016246653:dsa-429603003980&utm_loc_interest_ms=&utm_loc_physical_ms=9303066&gclid=Cj0KCQjwkZiFBhD9ARIsAGxFX8CaGxK_PgxC3Bk12vrfSe2QOm8pUJZkuzli9S-hKQp0bFYMfLAPTecaAkQ6EALw_wcB

A KeyError in Python is raised when you try to access a dictionary key that doesn’t exist in the dictionary. This error occurs when you try to access a dictionary value using a key that doesn’t exist in the dictionary. The error message typically includes the name of the key that was not found in the dictionary.

To handle this error, you can either check if the key exists in the Python dictionary before trying to access it, or use the .get() method which allows you to specify a default value to return if the key does not exist in the dictionary.

my_dict = {"a": 1, "b": 2}
if "c" in my_dict:
    print(my_dict["c"])
else:
    print("Key 'c' not found in the dictionary")

I see you’re facing a KeyError while executing your Python code for the bitcoin alert system.
As you mentioned, a KeyError occurs when you try to access a dictionary key that doesn’t exist in the dictionary. To fix this error, you can either check if the key exists in the dictionary before trying to access it or use the .get() method.
If you’re new to Python or programming in general, I recommend checking out some beginner-friendly resources like Swing Trading for Beginners to get a better understanding of the basics of crypto. Don’t hesitate to ask for help or clarification if you need it - the programming community is always willing to lend a hand.