Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Farouk Charkas
1,957 PointsHow do I do this? I would appreciate any feedback!
Now I am making an AI script with a feelings feature. But I would enter "You Stupid" and it would reply "I did not understand that". Here is my code:
elif userInput in ['You'] and ['stupid']:
print "That is mean! I am ending this conversation!"
#I deleted the feelings script below
How do I make it check for 'You' and 'stupid'
2 Answers

Ryan Lail
4,386 PointsOkay so I think I know how to do this.
user_input = userInput.split() #splitting the input into a list
for word in user_input:
if word == "You" or word == "you" or word == "Stupid" or word == "stupid": #You could convert the user input into all lowercase here if you wanted
print "That is mean! I am ending this conversation!"
break #so if the user enters you AND stupid, it won't repeat "That is mean! I am ending this conversation!"

Ryan Lail
4,386 PointsI think you want:
elif userInput == "You Stupid":
print "That is mean! I am ending this conversation!"
#I deleted the feelings script below

Farouk Charkas
1,957 PointsNo I would like it to make it only check for you stupid, like it will also accept You are so stupid
Farouk Charkas
1,957 PointsFarouk Charkas
1,957 PointsReasonable, how do I set all letters to lowercase?
Ryan Lail
4,386 PointsRyan Lail
4,386 PointsSo this would be the complete code. I also cleaned it up a bit. Just ask if you need anymore help.