0

I have a Python dictionary, say dict1, with some key-value pairs. I'd like to create a new dictionary dict2, with the same keys, but different values, based on values in dict1. For example:

dict1 = {'A':4, 'B':7, 'C':5}

dict2 is somewhat like {'A':(4/t^2), 'B':7/(t^2), 'C':5/(t^2)}, etc. based on some t.

So the new dict2 values are created from dict1 values, for corresponding keys. I have tried looping using items, etc. but without much success.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Jay
  • 13
  • 5

0 Answers0