Reputation: 2087
In PyCharm if I use the Python Console to define some variable like:
>>> import numpy as np
>>> scale = np.random.rand(1)[0]
I am not getting any feedback, so to actually see the value of scale
I need to:
>>> scale
0.6160226502566429
Any way of getting the value without the second line?
Upvotes: 1
Views: 48
Reputation: 8011
If you are using python3.8+, you can use (scale := np.random.rand(1)[0])
, which will return the value but also assign the variable.
See https://www.python.org/dev/peps/pep-0572/
Upvotes: 1