Answer the question
In order to leave comments, you need to log in
How to check if an element is in a text array?
I am writing a voice assistant, I made a text array of options for commands that can be set to an assistant, and I can’t check if there is a given word or expression that was said into the microphone in the array
voice = r.recognize_google(audio, language = "ru-RU").lower()
cmdList = {
"hello": ('привет','добрый день','добрый вечер','доброе утро'),
}
for x in cmdList["hello"]: #посмотрел в интернете примеры, этот код надо исправить
if cmdList == voice:
speak("Доброго времени суток мой Господин")
break
else:
speak("Не вели казнить! Я не знаю такую команду")
break
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question