Help, it's urgent!!

Whenever I input 'YouTube' it opens YouTube But whenever I input something else then also it opens YouTube Plz help Disclaimer: You will require a pc or laptop to view this becz it contains pyttsx3 https://code.sololearn.com/cK8MQy1jy9U7/?ref=app

11th Sep 2022, 2:19 AM
Kaushik - avatar
3 Answers
+ 2
Idk how this engine works, but this line: if 'youtube' or 'Youtube' or 'Open youtube' == input_user evaluates 'youtube' as being different from False and executes that. It should be: if 'youtube' == input_user or 'Youtube' == input_user or 'Open youtube' == input_user: Although I would suggest: if 'youtube' in input_user.lower(): The same with the google one.
11th Sep 2022, 2:46 AM
lion - avatar
11th Sep 2022, 5:48 AM
Lisa - avatar
Kaushik if 'abc' will always return True because it is a value and you are not comparing with any other value if Earth => True if Earth == Moon => False because both are not same if 'Kaushik' => True if ('Kaushik' == 'AJ') => False if ('Kaushik' == 'Kaushik') => True
11th Sep 2022, 5:49 AM
A͢J - avatar