I have the following list …
Test = [5.3, 5.3, 33.0, 15.3, 7.2, 7.2, 457.2, 439.5, 438.0, 427.1, 409.4, 408.0, 408.0, 408.0, 408.0, 408.0, 408.0, 408.0, 408.0, 408.0, 397.2, 379.5, 378.0, 367.2, 349.5, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0, 348.0]
I need to modify all the values if one value is over 400.
How could this be achieved with list comprehension. I need to keep all other values and only modify values after 400.
if maxvalue > 400:
print (maxvalue,'this is max value')
it = itertools.dropwhile(lambda x: x != maxvalue, Test)
next(it)
for num in it:
print(num-108)
fixedo = num-108
This code partially works but creates a new list with only the new modified values.