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

جواب «Ready for Bale» چالش 5 از جلسه‌ی 17

سؤال

قبل از روشن کردن، ربات را آماده کن: /start → Hi! I am Quiz Helper, a bot made by a student. Send /help.، /help → Commands: /start /help /quiz، و هر چیز دیگر → Sorry, I don't know that yet. Send /help. (پیام را با .strip().lower() مرتب کن.)

راهنما

reply با text = text.strip().lower()، دو if با return و یک return آخر؛ بعد bot.run(reply).

یک جواب درست

import bot


def reply(text):
    text = text.strip().lower()
    if text == "/start":
        return "Hi! I am Quiz Helper, a bot made by a student. Send /help."
    if text == "/help":
        return "Commands: /start /help /quiz"
    return "Sorry, I don't know that yet. Send /help."


bot.run(reply)

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