Using getter or setter in main function

python

#1

I have a class that I created the following

def verify_credit_card(self, security_code):
    if self.__creditCardCode == security_code:
        return True
    else:
        return False

I want to use it here

codeChoice = input("Please enter 3-digit code: ")
        if codeChoice != customerOne.getCreditCardCode():
            print("Security code incorrect. Payment rejected.")
            make_payment(customerOne, grandTotal)

so I want the user to enter a code and send it to the method to make sure it is correct then send back a true or false, if it matches.


#2

We need to see a little more of the class itself so all data points are exposed, as well as any methods. Much easier to navigate.


#3

Hey Thanks for the reply, but I was able to figure it out, thanks!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.