I have a dictionary with only one entry (key names are varying and I don't know them) and want to divide the value by another integer value.
Since dict.values()
only delivers dict views which were not suitable for a division, my workaround was to convert the dictionary value into a list and getting the element by its index:
in_max = {'b_el': 100000}
soc_max = 700000
c_rate_in = [in_max[k] for k in in_max][0] / soc_max
print(c_rate_in)
0.14285714285714285
But this solution seems to be a bit heavy-handed to me and also does not look very nice.
Is there a smarter way to get the same result?