0
Is there any way to compare all item values in a dictionary? For example:
a = {'valor1': 4, 'valor2': 5, 'valor3': 4}
b = {'valor1': 2, 'valor2': 2, 'valor3': 8}
if a['valor1']*2<b['valor1']:
print(f'\033[31m{b[valor1]}\033[m')
else:
print(f'{b[valor1]}')
I would like to compare the dictionary values a and b and if a dictionary value b is 2 times higher than the dictionary value the value will be painted red.
PS: I would like to compare a value1 with b value1, a value2 with b value2, and so on.
The two dictionaries have exactly the same keys?
– Daniel Mendes
yes, the only things that change are the values
– Nix