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

جواب «Kind, Unkind or Can't Tell» چالش 4 از جلسه‌ی 33

سؤال

امتیاز جمله‌ای که با input می‌آید حساب و چاپ شده. حالا برچسب بزن: اگر total > 0 بود kind، اگر total < 0 بود maybe unkind، وگرنه can't tell. برای what a great idea:
score: 2
kind

راهنما

if total > 0: ... elif total < 0: ... else:.

یک جواب درست

WEIGHTS = {"great": 2, "fun": 2, "love": 2, "nice": 1, "cool": 1, "kind": 2,
           "boring": -2, "bad": -1, "stupid": -3, "ugly": -2, "hate": -3, "slow": -1}

sentence = input().lower()
total = 0
for word in sentence.split():
    total += WEIGHTS.get(word, 0)
print("score:", total)
if total > 0:
    print("kind")
elif total < 0:
    print("maybe unkind")
else:
    print("can't tell")

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