Source code for greetings.greeter

from colorama import Fore


[docs]def greet(personal, family, title="", polite=False): """Generate a greeting string for a person. Parameters ---------- personal: str A given name, such as Will or Jean-Luc family: str A family name, such as Riker or Picard title: str An optional title, such as Captain or Reverend polite: bool True for a formal greeting, False for informal. Returns ------- string An appropriate greeting """ greeting = "How do you do, " if polite else "Hey, " greeting = Fore.GREEN + greeting if title: greeting += Fore.BLUE + title + " " greeting += Fore.RED + personal + " " + family + "." return greeting