0

This is my current code:

cu = 0
while cu != "stop" and cu != "Stop" and cu != "STOP" and cu != "quit" and cu != "Quit" and cu != "QUIT":
    cu = str(input("Say anything to computer robot! Or say stop or quit and leave him alone and sad: "))
    if "how" or "How" in cu:
        print("I'm good, you?")
    elif "Im good" or "Im well" in cu:
        print("Fantastic!")
    break

Here is the output:

Say anything to computer robot! Or say stop or quit and leave him alone and sad: How are you?
I'm good, you?
Say anything to computer robot! Or say stop or quit and leave him alone and sad: asdf
I'm good, you?
Say anything to computer robot! Or say stop or quit and leave him alone and sad: Im good
I'm good, you?

I want it to output "I'm good, you?" if the input contains "how" or "How" and I want it to output "Fantastic!" if the input contains "Im good" or "Im well".

Note I'm a beginner at programming. Thank you for the help.

JCJG
  • 1
  • 1
  • 3
  • `if "how" or "How" in cu:` doesn't do what you think it does. Use `if 'how' in cu.lower():` instead, or use `if 'how' in cu or 'How' in cu:` if you need more control over exact capitalisations. – Martijn Pieters Feb 08 '15 at 00:29
  • And for the while condition, you can shorten it to `while cu.lower() not in ('stop', 'quit'): …` – poke Feb 08 '15 at 00:30
  • I can't seem to figure out how to get the .lower thing to work. – JCJG Feb 08 '15 at 02:26

0 Answers0