Mar-16-2019, 12:35 AM
Hi,
I need help with combining two if statements. The problem is that both need to return something but the function goes out of scope after the first "return" and does not continue.
Thank you!
I need help with combining two if statements. The problem is that both need to return something but the function goes out of scope after the first "return" and does not continue.
def comparison(industry, salary): if industry == "production": return "Average salary of this industry was " + str(df['Average'].min()) + "." if salary > int(df['Average'].min()): return "Above the average salary" elif salary < int(df['Average'].min()): return "Below the average salary" elif salary == int(df['Average'].min()): return "Average salary" else: return "Yearly average salary was " + str(df['Average'].max()) + "." if salary > int(df['Average'].max()): return "Above the average salary" elif salary < int(df['Average'].max()): return "Below the average salary" elif salary == int(df['Average'].max()): return "Average salary"I believe there is some efficient way to combine these two IF statements but unfortunately I have not been able to figure it out although I have "googled".
Thank you!