I'm trying to achieve a for-if-statement in one line:
I have a zipped list of lists and want to iterate through the entries and check for something.
def some_function(Q_chosen, Number_chosen, Energy_chosen, info_field_calc):
for Q_out, fieldreal_out, Number_out, Energy_out, Vebit_out in info_field_calc:
if Q_out == Q_chosen and Number_out == Number_chosen and Energy_out == Energy_chosen:
listfields = fieldreal_out
I want to get the for and if statement in one line using the data types that I'm already using now. Is that possible?
Thanks a lot in advance!