Python Project: Chatbot: Please Review

I am would really like to get some reviews on this project. It is a work in progress so is not very long but I would really like to get some ideas and critics on my formatting or tone (or anything else really). All reviews are very helpful and wanted as long as they are not rude. The code I would like reviewed is below. Thanks in advance :slightly_smiling_face:

#Imports
import time

#Introduction
print ("Hello, I am Ivy.\n")
time.sleep(4)
print ("I am here to share your thoughts and feelings \nwith.\n")
time.sleep(4)
print ("Basically, I am your virtual best friend.\n")
time.sleep(4.5)
print ("To help you with this I will first need to \nknow a couple of details.\n")
time.sleep(4)

#Name
firstname = input ("What is your first name?\n\n\t\t\t\t")
time.sleep(1)
surname = input ("\nWhat is your surname?\n\n\t\t\t\t")
time.sleep(2)
print ("\n" + firstname, surname, "is a lovely name.")
time.sleep(2)
print ("\nYou are so lucky to have such a beautiful \nname.")
time.sleep(2)

#Feeling Info
print ("\nNow let's get on with talking about how you are feeling.\n")
time.sleep(2)
feeling = input("How are you feeling today?\n\n\t\t\t\t")

#Feeling Answers
if feeling in["Sad","sad","Unhappy","unhappy"]:
	feeling = "sad"
	print("\nOh no! It's not good that you are feeling \nsad but is a completely normal feeling \nto have and it will go away soon.")
elif feeling in["Happy","happy"]:
	feeling = "happy"
	print("\nYay! I am so glad that you are feeling \nhappy!")
elif feeling in["good","Good"]:
	feeling = "good"
	print("\nYay! I am so glad that you are feeling \ngood!")
elif feeling in["Excited","excited"]:
	feeling = "excited"
	print("\nYay! Let's boogey with excitment!")
elif feeling in["Hungry","hungry"]:
	feeling = "hungry"
	print("\nI'm feeling hungry too! Lets hope your not \ngetting hangry...")

#Reason
reason_question = "\nWhy are you feeling "+ feeling + "?\n\n\t\t\t\t"
reason = input(reason_question)
1 Like

OMG So cool! I love it - nothing to improve from me. :grinning: :grinning:

Update:

#Imports
import time

#Introduction
print ("Hello, I am Ivy.\n")
time.sleep(4)
print ("I am here to share your thoughts and feelings \nwith.\n")
time.sleep(4)
print ("Basically, I am your virtual best friend.\n")
time.sleep(4.5)
print ("To help you with this I will first need to \nknow a couple of details.\n")
time.sleep(4)

#Name
firstname = input ("What is your first name?\n\n\t\t\t\t")
time.sleep(1)
surname = input ("\nWhat is your surname?\n\n\t\t\t\t")
time.sleep(2)
print ("\n" + firstname, surname, "is a lovely name.")
time.sleep(2)
print ("\nYou are so lucky to have such a beautiful \nname.")
time.sleep(2)

#Feeling Info
print ("\nNow let's get on with talking about how you are feeling.\n")
time.sleep(2)
feeling = input("How are you feeling today?\n\n\t\t\t\t")

#Feeling Answers
if feeling in["Sad","sad","Unhappy","unhappy"]:
	feeling = "sad"
	time.sleep(4)
	print("\nOh no! It's not good that you are feeling \nsad but is a completely normal feeling \nto have and it will go away soon.")
elif feeling in["Happy","happy"]:
	feeling = "happy"
	time.sleep(2)
	print("\nYay! I am so glad that you are feeling \nhappy!")
elif feeling in["good","Good"]:
	feeling = "good"
	time.sleep(2)
	print("\nYay! I am so glad that you are feeling \ngood!")
elif feeling in["Excited","excited"]:
	feeling = "excited"
	time.sleep(2)
	print("\nYay! Let's boogey with excitment!")
elif feeling in["Hungry","hungry"]:
	feeling = "hungry"
	time.sleep(2)
	print("\nI'm feeling hungry too! Lets hope your not \ngetting hangry...")
elif feeling in["angry","Angry"]:
	feeling = "angry"
	time.sleep(4)
	print("Oh no! No one wants to feel angry and it's\nnot good but it will fade and you could try\nmeditation to prevent it from happening \nfrequently. ")
elif feeling in["Sleepy","sleepy","Tired","tired"]:
	feeling = "tired"
	time.sleep(2)
	print("*Yawning* I feel tired too...")

#Reason
time.sleep(2)
reason = input("\nWhy are you feeling "+ feeling + "?\n\n\t\t\t\t")
print ("\nYes, that makes me feel", feeling, "too.")
2 Likes

Thanks for your review :grinning: ! I am sure there are things that can be improved but I will take your compliment.

Hi there! it is a good effort for a first time. One question, what happens if the ‘user’ enters something unexpected in the feelings question? I ask because I don’t see you finishing the elif statements with an else which would catch any unintended answers

Second thing, you can use the string method .lowercase() on the feeling input, that way you don’t need to include the lowercase/uppercase version of each variation of the feeling in the lists.

Hello this is cool! Some things could be a little bit more user friendly, but the code is good. First what I think might make it a little better is if you could print out something where it says to input sad, happy, hungry, or angry something like that so then it will return one of the if statements. Lastly one thing I don’t think needs to be changed but its just a preference in the if and elif statements is that the if could be like this: if “happy” in feeling.lower time.sleep(2) print("\n Yay! I am so glad that you are feeling \nhappy"). But this was a cool project and if was fun to do a review this was good.