Last active
December 4, 2018 11:16
-
-
Save pelid/dcd98c469cb2f653f37015afa208f7e4 to your computer and use it in GitHub Desktop.
Template for print_receipt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_formatted_receipt(products): | |
"""Функция создает новый чек, принимает на вход любой список покупок - `products`. | |
Функция сама не вызывает `print`, только готовит строки к последующему | |
выводу на экран или печати.""" | |
receipt_lines = [] | |
# поместите сюда основной цикл, наполните receipt_lines строками. | |
# используйте метод списка append - receipt_lines.append(line) | |
return receipt_lines | |
def print_all_lines(lines): | |
for line in lines: | |
print(line) | |
receipt = create_formatted_receipt(PRODUCTS) | |
print_all_lines(receipt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
В функции
def create_formatted_receipt
используется механизм встроенной документации docstings. Это строка с тройными двойными кавычками""" .... """
, размещенная сразу под объявлением функции.