vendredi 28 avril 2017

Need some help: Passing variables in functions and printing them

'new to programming' post I have an issue with my code.

    def function_test(valid_employee,employee_number):
        print """ valid_employee : %d \n employee_number: %d""" %.     (valid_employee,employee_number)
if employee_number == valid_employee:              # my if statement seems to be wrong:
        print " EMPLOYEE NUMBER RECOGNISED, WELCOME %d " %(employee_number)
else:
        print "EMPLOYEE NOT RECOGNISED"

     print "Please enter your employee_number "
     employee_number = int (raw_input())
     test_function = function_test(030532,employee_number)

I'm trying to pass 030532 (the valid_employee) but everytime time I print it, in the function(function_test) I get the value '12634' when it should be '030532'. I am using an if statement to check both employee_number and valid_employee within the function to confirm if the employee is valid.. that being valid_employee (should be 030532) is the same as employee_number. I think there seems to be a problem with me passing variables

employee_number seems to be printing fine, I get the value I want 030532 or should I say '30532'. I pass '030532' to the test_function as the first argument, but it doesn't seem to pass to the function when I print valid_employee is keep getting 12634?

anyway guys sorry if I am not explaining this coherently, I appreciate your input thanks guys.

Aucun commentaire:

Enregistrer un commentaire