File size: 553 Bytes
aed86da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from typing import Optional
print(
f"executing the file '{__file__}'"
f"in module '{__name__}' and package '{__package__}'"
)
def build_greetings(name: Optional[str] = None) -> str:
"""
Return a greeting message, possibly customize with a name.
>>> build_greetings()
'Hello, World!'
>>> build_greetings('Toto')
'Nice to meet you, Toto!'
"""
return name and f"Nice to meet you, {name}!" or "Hello, World!"
def main():
print(build_greetings())
if __name__ == "__main__":
main() # pragma: no cover
|