Exemplo n.º 1
0
def hypothetical_philanthropist():
    global my_donors
    while True:
        try:
            multiplier = int(
                input("\nWhat factor would the philanthropist "
                      "like to multiply donations by? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            min_donation = int(input("\nWhat is the min donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            max_donation = int(input("\nWhat is the max donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    new_list = donor_list_multiplier(my_donors, multiplier, min_donation,
                                     max_donation)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    original_total_donations = 0
    for donor in my_donors.donor_dictionary:
        original_total_donations += sum(donor.donations)
    total_donations = 0
    for donor in new_donor_list.donor_dictionary:
        total_donations += sum(donor.donations)
    print('\nThe total donations after your gift will be {}. Your share is {}'.
          format(total_donations, total_donations - original_total_donations))
Exemplo n.º 2
0
def philanthropist():
    global my_donors
    while True:
        try:
            multiplier = int(
                input("\nWhat factor would the philanthropist "
                      "like to multiply donations by? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            min_donation = int(input("\nWhat is the min donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    while True:
        try:
            max_donation = int(input("\nWhat is the max donation to match? "))
            break
        except ValueError:
            print("\nThat wasn't a number value.")
    new_list = donor_list_multiplier(my_donors, multiplier, min_donation,
                                     max_donation)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    my_donors = new_donor_list
def philanthropist():
    global my_donors
    multip, min_donate, max_donate = get_philan_info()
    new_list = donor_list_multiplier(my_donors, multip, min_donate, max_donate)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    my_donors = new_donor_list
def hypothetical_philanthropist():
    global my_donors
    multip, min_donate, max_donate = get_philan_info()
    new_list = donor_list_multiplier(my_donors, multip, min_donate, max_donate)
    new_donor_list = Donor_list()
    for new_donor in new_list:
        new_donor_list.add_donor(new_donor)
    orig_total = donor_list_sum(my_donors)
    hypo_total = donor_list_sum(new_donor_list)
    print('\nThe total donations after your gift will be {}. Your share is '
          '{}'.format(hypo_total, hypo_total-orig_total))
Exemplo n.º 5
0
def test_donor_list_add_donor():
    alex = Donor('Alex', [100])
    ryan = Donor('Ryan', [300])
    a = Donor_list(alex)
    a.add_donor(ryan)
    assert a.donor_dictionary == [alex, ryan]