hello = input() if hello == 'Hello Eva': name=input('Hello. Who are you? ') name=name.split(' ') name=name[0] name = ''.join(name) happy=['happy'] sad=['sad'] angry=['angry'] address = input('What is your address, '+name+'? ') address=address.split(' ') number=int(''.join(address[0]))-3 address[0]=number address[0]=str(address[0]) print('Thats crazy! I live at '+' '.join(address)+'. Just 3 houses down from you.') while hello == 'Hello Eva': mood=input('How are you today '+name+'? ') if mood not in happy: if mood not in sad: if mood not in angry: print("Sorry. I don't understand what",mood,"means. Could you please tell") new_mood = input("me what emotion it is closest to?(happy, sad or angry) ") new_mood=new_mood.strip() happystr='happy' sadstr='sad' angrystr='angry' if new_mood == happystr: happy.append(mood) elif new_mood == sadstr: sad.append(mood) elif new_mood == angrystr: angry.append(mood) if mood in happy: print("That's good to hear.") elif mood in sad: problem=input("I feel sorry for you. So, tell me, what happend?") print("That's not good") elif mood in angry: problem=input("Hmm, that's not good. What's wrong?") print('OK, that was worse than what I was expecting.') hello = input() if hello == 'Goodbye': print('Goodbye, '+name)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question