Exemplo n.º 1
0
def add_new_name(name: str = ""):
    my_data.update({name: bunch(total=0., number=0)})
    return True
Exemplo n.º 2
0
#!/usr/bin/env python
__author__ = 'Tim Lurvey, ig408c'

import sys
from lurvey_classes import bunch

my_data = {}
my_data.update({'Tom Hanks': bunch(total=24536.20, number=3)})
my_data.update({'Barry Larkin': bunch(total=4521., number=3)})
my_data.update({'Mo Sizlack': bunch(total=88.88, number=2)})
my_data.update({'Anonymous': bunch(total=100., number=1)})
my_data.update({'Donnald Trump': bunch(total=1., number=3)})


def add_new_name(name: str = ""):
    my_data.update({name: bunch(total=0., number=0)})
    return True


def compose_email(name: str = "", donation: float = 0., data: any = None):
    """return the string of the formatted email"""
    if data.number < 1:
        s = ""
        is_are = "is"
    else:
        s = "s"
        is_are = "are"
    #
    email_str = "\nHello {name},\n\n" \
                "Thank you for your generous donation of $ {donation:.2f}.\n" \
                "Your {count} donation{s}, totaling $ {total:.2f}, {is_are} greatly appreciated.\n\n" \