بتل کد Battle Codeدارد باز می‌شود…

جواب «Step 1: The Model Card» چالش 1 از جلسه‌ی 48

سؤال

model_card(name, data, right, total, mistakes) کارت را چاپ کند:
MODEL CARD: Robo Garden Helper
Data: the Robo Garden handout (4 parts, made up)
Accuracy: 70 % (7 of 10)
Where it goes wrong:
و بعد هر اشتباه در یک خط با - اول.

راهنما

درصد: right * 100 // total. پرانتز را با چسباندن رشته بساز: "(" + str(right) و str(total) + ")".

یک جواب درست

def model_card(name, data, right, total, mistakes):
    print("MODEL CARD:", name)
    print("Data:", data)
    print("Accuracy:", right * 100 // total, "%", "(" + str(right), "of", str(total) + ")")
    print("Where it goes wrong:")
    for m in mistakes:
        print("-", m)


# ---- test (do not change) ----
model_card("Robo Garden Helper", "the Robo Garden handout (4 parts, made up)", 7, 10,
           ["answers that need the second sentence of a part", "the word 'run' vs 'runs'"])

اول خودت امتحان کن؛ جواب‌های دیگر هم قبول است. برگرد و خودت حلش کن