Printing and formatting

← Back to assignments

ungraded
# Google is encouraged. Type what you find, do not paste it. # ---- Part 1: print ---- def greet(name): """Print a greeting. greet("Ada") → (output) Hello, Ada! Search: "python print". """ raise NotImplementedError # ---- Part 2: string formatting ---- def price_tag(item, price): """Print a price tag with the price at two decimals. price_tag("tea", 3.5) → (output) tea: $3.50 Search: "python f-string decimal places". """ raise NotImplementedError def shout(text): """Print the text in capitals with an exclamation mark. shout("careful") → (output) CAREFUL! Search: "python string upper". """ raise NotImplementedError def aligned(label, value): """Print the label padded to width 10, then the value. aligned("name", 7) → (output) name······7 (······· stands for spaces) Search: "python f-string padding". """ raise NotImplementedError