0
donors = [
    {
        "first" : "John",
        "last" : "Quigley",
        "donations" : [
            {
                "date" : "2020-07-02",
                "amount" : 5000
            }
        ]
    }
]

def lookup(first_name, last_name):
    for donor in donors:
        if donor['first'] is first_name and donor['last'] is last_name:
            return donor
        else:
            print("That donor is not on the list
            send_thank_you()

def send_thank_you():
    first_name = input("What is the first name?\n")
    last_name = input("What is the last name of the donor?\n")
    donor = lookup(first_name, last_name)
    return donor

print(send_thank_you())

lookup() works when called outside of send_thank_you(). If I manually input lookup("John", "Quigley") it works, though it doesn't work if I follow input prompts. Why is this?

0 Answers0