The object is to notify if a plane was found or not.
The aircraft_identifier
variable is a must. cpl_id
and target_no
are optional, only either of them can be applied at time not both, they are used for further identification if aircraft_identifier is not unique.
qo = 'squawk' or 'callsign' # only these variants are possible
qo_squawk = '12345'
qo_callsign = 'AMAN3'
qo_cplId = '11'
qo_targetNo = '22'
def decision_making(aircraft_identifier, cpl_id=None, target_no=None):
found_target = False
if qo == 'callsign' or qo == 'squawk':
if aircraft_identifier.isdigit():
found_target = (aircraft_identifier == qo_squawk)
else:
found_target = (aircraft_identifier == qo_callsign)
if found_target:
if cpl_id:
found_target = True if qo_cplId == cpl_id else False
if target_no:
found_target = True if qo_targetNo == target_no else False
if found_target:
print('Found target!')
return
print('plane not found in list!')
decision_making('AMAN3', '22')
Can this code be made simpler?
decision_making()
, as well as the fact that the function doesn't return any useful value, I suspect that real gains would be made by changing the design of your entire program. I encourage you to ask another question containing more of your code. \$\endgroup\$