Working with if-else statements
This is part of an assignment I have due tomorrow. Not sure what I'm doing wrong, because it won't recognize the if statements at all, and instead just take the 'else' action even if the input is valid and should in fact return the if action. Here's the code: def a(): for i in employees: pr = int(input("Enter the payroll number: ")) if pr==i[0]: print('%-30s' % (i[4]+ ','+' '+i[3]), '%30s' % i[0], '%30s' % i[1], '%30s' % i[2]) else: print("There is no such employee") #there's a list with employee names, surnames, payrolls, salary and job title. Can paste the whole thing if needed. Over here I am trying to say if the user input value matches the value at position 0 in the list (which is the payroll), then type the details of that row. It's only outputting "there is no such employee". def b(): salmin = int(input("Enter the minimum salary: ")) salmax = int(input("Enter the maximum salary: ")) salaryrange = salmin<=salary<=salmax if salaryrange in employees: print("test") else: print("There are no employees within that salary range") #trying to select and display the details of the employees within a salary range. Again, only outputs else statement. def c(): jobs = input("Enter the job title: ") while jobs in employees: print(surname+",", name) else: print("There is no such job") #trying to say if the user input value exists in the list, then print the selected details of the identified rows matching the value input. Only outputs "there is no such job". What exactly am I doing wrong? EDIT: Never used playground before, didn't know you could save and link code. Here's the link (I think): https://code.sololearn.com/cjJ8vmpf7uDD/#py