how to multiply or add each element with a number

A short version of how to multiply or add each element in dictionary with some number.

Example

ready = {k:v + sum for k, v in dictionary.items()}

Error

If an error like this occurs:

return self.view_functions[rule.endpoint](**req.view_args)
in calculate_results
for x, v in response_rub_in_usd:
ValueError: too many values ​​to unpack (expected 2)

Try adding .items() to the dictionary, as in the example above.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *