I'm new at Python and trying to create a simple - or so I thought - conversation between a bot and a user for a small party I'm hosting in two weeks. However, I would try to make a individual conversation for everybody that will attend. For example: when I type in my name, the script will generate several other questions which are geared to my interests etc., when a friend of mine types in his/her name, the script does the same for him/her. I have the following very short bit of code already, but it does not seem to work. It does work when I ask just one question per user, or if I write out the different questions for one user, but I can't seem to be able to combine both. Could someone help me out. Thanks in advance!
name=raw_input("Hello, what is your name?\n")
if "ohn" in name:
print "Hello " + name+", glad of you to join us!"\n"
second_question=raw_input('Why did you come to this party?\n')
elif "arc" in name:
print "Wow" + name+", so great you are here as well!\n"
closeInput = raw_input("Press ENTER to exit")
print "Closing..."
You may also want to consider string formatting instead of concatenating
For instance,
or
instead of
It may not seem like much, but if you want to start putting more variables into the string you're printing, concatenating the way you're doing can become very cumbersome.