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

جواب «Shall We Go to the Park?» چالش 2 از جلسه‌ی 30

سؤال

سه ورودی با input خوانده می‌شوند (هر کدام 1 یا 0): آفتابی، تکلیف تمام، دوست می‌آید. وزن‌ها 2، 3 و 1 هستند و آستانه 4. total را حساب و چاپ کن، بعد اگر total >= 4 بود go to the park!، وگرنه stay home. با 1، 1، 0:
total: 5
go to the park!

راهنما

total = sunny * 2 + homework * 3 + friend * 1، بعد if total >= 4:.

یک جواب درست

sunny = int(input())
homework = int(input())
friend = int(input())
total = sunny * 2 + homework * 3 + friend * 1
print("total:", total)
if total >= 4:
    print("go to the park!")
else:
    print("stay home")

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