Please write a function that will take a string as input and return a hash. The string will be formatted as such. The key will always be a symbol and the value will always be an integer.
"a=1, b=2, c=3, d=4"
This string should return a hash that looks like
{ 'a': 1, 'b': 2, 'c': 3, 'd': 4}
def str_to_hash(st):
# your code here
pass
def str_to_hash(st):
return {i[0]:int(i[1]) for i in [item.split("=") for item in st.split(", ")]} if len(st) > 0 else {}