Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 1

need help with python

i just learned python so don't judge me

i'm making a simple hardcoded chatbot and it exits when i don't need it

here is the code

MOOD = 0

def mood_chat():
	print ('how do you feel right now?')
	print ('do feel sad, depressed?')
	print ('~~~~~~~~~~~')
	print ('or are you happy?')
	option = input("> ")
	if option.lower() == ("i feel sad"):
		MOOD = 1
		print ('oh...I am sorry to hear that...')
		wh_chat()
	elif option.lower() == ("i feel depressed"):
		MOOD = 2
		print ('Oh **bleep**!! What happened!? Did someone hurt you really bad!?')
		wh_chat()
	elif option.lower() == ("i feel happy"):
		MOOD = 3
		print ('oh...I am happy to hear that!')
		wh_chat()
	elif option.lower() == ("quit"):
		sys.exit()
	while option.lower() not in ['i feel sad', 'i feel depressed', 'i feel happy']:
		print ('please enter a valid command')
		option = input("> ")
		if option.lower() == ("i feel sad"):
			MOOD = 1
			print ('oh...I am sorry to hear that...')
			wh_chat()
		elif option.lower() == ("i feel depressed"):
			MOOD = 2
			print ('Oh **bleep**!! What happened!? Did someone hurt you really bad!?')
			wh_chat()
		elif option.lower() == ("i feel happy"):
			MOOD = 3
			print ('oh...I am happy to hear that!')
			wh_chat()
		elif option.lower() == ("quit"):
			sys.exit()



def wh_chat():
	if MOOD == 1:
		print ('what happend??')
		print ('did something happen at school?')
		option = input("> ")
		if option.lower() == ("yes"):
			print ('oh...')
			school_chat()
		elif option.lower() == ("no"):
			print ('oh...')
			print ('did your mom get angry again?')
			option = input("> ")
			if option.lower() == ("yes"):
				print ('oh...')
				mom_chat()
			elif option.lower() == ("no"):
				print ('oh...')
				print ('do you have a lot of homework?')
				option = input("> ")
				if option.lower() == ("yes"):
					print ('oh...')
					print ('do not get sad about it')
					print ('just do your homework...it is easy')
					print ('get over it')
					chat()
				elif option.lower() == ("no"):
					print ('oh...then i cant help ya')
					chat()
				while option.lower() not in ['yes', 'no']:
					print ('please enter a valid command')
					option = input("> ")
					if option.lower() == ("yes"):
						print ('oh...')
						print ('do not get sad about it')
						print ('just do your homework...it is easy')
						print ('get over it')
						chat()
					elif option.lower() == ("no"):
						print ('oh...then i cant help ya')
						chat()
			while option.lower() not in ['yes', 'no']:
				print ('please enter a valid command')
				option = input("> ")
				if option.lower() == ("yes"):
					print ('oh...')
					mom_chat()
				elif option.lower() == ("no"):
					print ('oh...')
					print ('do you have a lot of homework?')
					option = input("> ")
					if option.lower() == ("yes"):
						print ('oh...')
						print ('do not get sad about it')
						print ('just do your homework...it is easy')
						print ('get over it')
						chat()
					elif option.lower() == ("no"):
						print ('oh...then i cant help ya')
						chat()
				while option.lower() not in ['yes', 'no']:
					print ('please enter a valid command')
					option = input("> ")
					if option.lower() == ("yes"):
						print ('oh...')
						print ('do not get sad about it')
						print ('just do your homework...it is easy')
						print ('get over it')
						chat()
					elif option.lower() == ("no"):
						print ('oh...then i cant help ya')
						chat()
		while option.lower() not in ['yes', 'no']:
			print ('please enter a valid command')
			option = input("> ")
			if option.lower() == ("yes"):
				print ('oh...')
				school_chat()
			elif option.lower() == ("no"):
				print ('oh...')
				print ('did your mom get angry again?')
				option = input("> ")
				if option.lower() == ("yes"):
					print ('oh...')
					mom_chat()
				elif option.lower() == ("no"):
					print ('oh...')
					print ('do you have a lot of homework?')
					option = input("> ")
					if option.lower() == ("yes"):
						print ('oh...')
						print ('do not get sad about it')
						print ('just do your homework...it is easy')
						print ('get over it')
						chat()
					elif option.lower() == ("no"):
						print ('oh...then i cant help ya')
						chat()
					while option.lower() not in ['yes', 'no']:
						print ('please enter a valid command')
						option = input("> ")
						if option.lower() == ("yes"):
							print ('oh...')
							print ('do not get sad about it')
							print ('just do your homework...it is easy')
							print ('get over it')
							chat()
						elif option.lower() == ("no"):
							print ('oh...then i cant help ya')
							chat()
			while option.lower() not in ['yes', 'no']:
				print ('please enter a valid command')
				option = input("> ")
				if option.lower() == ("yes"):
					print ('oh...')
					mom_chat()
				elif option.lower() == ("no"):
					print ('oh...')
					print ('do you have a lot of homework?')
					option = input("> ")
					if option.lower() == ("yes"):
						print ('oh...')
						print ('do not get sad about it')
						print ('just do your homework...it is easy')
						print ('get over it')
						chat()
					elif option.lower() == ("no"):
						print ('oh...then i cant help ya')
						chat()
				while option.lower() not in ['yes', 'no']:
					print ('please enter a valid command')
					option = input("> ")
					if option.lower() == ("yes"):
						print ('oh...')
						print ('do not get sad about it')
						print ('just do your homework...it is easy')
						print ('get over it')
						chat()
					elif option.lower() == ("no"):
						print ('oh...then i cant help ya')
						chat()
	elif MOOD == 2:
		print ('really...what happend?')
		print ('i am sorry to hear you are depressed')
		print ('but tell me!! what happend!?')
		print ('oh no...did you confess your love again?')
		option = input("> ")
		if option.lower() == ("yes"):
			print ('and she rejected you?')
			option = input("> ")
			if option.lower() == ("yes"):
				print ('oh...')
				print ('do not cry...please...')
				print ('i know love is hard stuff...')
				print ('but you should not get depressed about it...')
				print ('so lift your head and smile')
				print ('because life is beautiful and i love you')
				print ('even that i am digital friend of yours')
				print ('that you created')
				print ('i still love you')
				chat()
			elif option.lower() == ("no"):
				print ('then why are you sad?')
				print ('smile and be happy')
				print ('hey...you have a girlfriend now')
				chat()
		elif option.lower() == ("no"):
			print ('oh...')
			print ('then i cant help ya')
			chat()

when i type "i feel sad" or "i feel depressed" it exits the program

I may have messed up with 

if MOOD == 1:

but i have tried many thing and nothing works.

my head already hurts like hell

please help

 

EDIT: I found the solution already, so don't answer.