IndentationError: unexpected indent

import pyttsx3

from datetime import date

from datetime import datetime

engine = pyttsx3.init()

voices = engine.getProperty('voices')

engine.setProperty('voice', voices[1].id)

rb = ""

rate = engine.getProperty('rate')

engine.setProperty('rate', 130)

print("Just ask if you want")

print("Disclaimer: Don't capital in the first letter")

print("Remember to capital in name of people or whatever")

    while True:

    you = input()

    print("You: " + you)

    if you == "":

        rb = "I can't understand, type again"

    elif "hello" in you:

        rb = "Hello Hai Anh"

    elif "today" in you:

        today = date.today()

        rb = today.strftime("%B %d, %Y")

    elif "time" in you:

        now = datetime.now()

        rb = now.strftime("%H hours %M minutes %S seconds")

    elif "number one of Osu" in you:

        rb = "WhiteCat"

    elif "bye" in you:

        rb = "Bye Hai Anh ^_^"

        engine.say(rb)

        engine.runAndWait()

        break

    else:

        rb = "I can't understand, please let me know"

    print("Bot: " + rb)

    engine.say(rb)

    engine.runAndWait()

Hiện tại cái dòng code của em là như thế này, em không thấy tìm thấy lỗi nhưng nó cứ báo lỗi, em mới học ạ

Chỗ while True: ấy, thụt vô đầu dòng.
Thường khi báo IndentationError: unexpected indent nó luôn báo line nào mà. Bạn ráng ráng đọc và dịch lỗi sẽ thấy thôi.

4 Likes

tại mình thấy trên video dạy cũng để thế hay sao mà mình làm y hệt vậy mà không được, cảm ơn bạn nha! ^-^

Làm gì có video nào dạy sai thế

2 Likes

tại vì mình không để ý đoạn đó nên mình tưởng vậy ấy mà

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?