嗨,如何让用户回复,打印声明,但它不允许我回复
hi how do get the user to responed back,printstatment but its not allowing me to responed back
print("你好!\n")
user_name = input("你叫什么名字?\n")
print("你好," + user_name + "\n")
print("你好吗?\n")
print(+ user_name + "\n")
好=“快乐”
好=“难过”
好=“自杀”
如果好!=“快乐”:
print("太棒了,"+ user_name + "\n")
elif 好==“伤心”:
print("很抱歉,我是僵尸网络,"+ user_name + "\n")
elif good == "自杀":
print("1-800 ('national Suicide Prevention')"+ user_name + "\n")
我想这是解决问题的众多方法之一:
print("hello!\n")
user_name = input("what is your name?\n")
print("hello, " + user_name + "\n")
print("how are you doing, " + user_name + "?\n")
good = input(""" 1. happy
2. sad
3. suicide
""")
if good == "happy" or good == "1": print("thats aswesome, "+ user_name + "\n")
elif good == "sad" or good == "2": print("I Am sorry but I am a bot, "+ user_name + "\n")
elif good == "suicide" or good == "3": print("1-800 ('national Suicide Prevention') "+ user_name + "\n")
结果:
hello!
what is your name?
Jack
hello, Jack
how are you doing, Jack?
1. happy
2. sad
3. suicide
2
I Am sorry but I am a bot, Jack
hello!
what is your name?
Jack
hello, Jack
how are you doing, Jack?
1. happy
2. sad
3. suicide
happy
thats aswesome, Jack
您没有收到提示,因为您没有要求任何输入,您可能想为 if else
定义一个基本情况
print("hello!\n")
user_name = input("what is your name?\n")
print("hello, " + user_name + "\n")
mood = input("how are you doing? %s \n" % user_name)
if mood == "happy": print("thats aswesome,"+ user_name + "\n")
elif mood == "sad": print("Am sorry but am a botnet,"+ user_name + "\n")
elif mood == "suicide": print("1-800 ('national Suicide Prevention')"+ user_name + "\n")
else: print("Sorry I don't understand it")
print("你好!\n")
user_name = input("你叫什么名字?\n")
print("你好," + user_name + "\n")
print("你好吗?\n")
print(+ user_name + "\n")
好=“快乐”
好=“难过”
好=“自杀”
如果好!=“快乐”: print("太棒了,"+ user_name + "\n")
elif 好==“伤心”: print("很抱歉,我是僵尸网络,"+ user_name + "\n")
elif good == "自杀": print("1-800 ('national Suicide Prevention')"+ user_name + "\n")
我想这是解决问题的众多方法之一:
print("hello!\n")
user_name = input("what is your name?\n")
print("hello, " + user_name + "\n")
print("how are you doing, " + user_name + "?\n")
good = input(""" 1. happy
2. sad
3. suicide
""")
if good == "happy" or good == "1": print("thats aswesome, "+ user_name + "\n")
elif good == "sad" or good == "2": print("I Am sorry but I am a bot, "+ user_name + "\n")
elif good == "suicide" or good == "3": print("1-800 ('national Suicide Prevention') "+ user_name + "\n")
结果:
hello!
what is your name?
Jack
hello, Jack
how are you doing, Jack?
1. happy
2. sad
3. suicide
2
I Am sorry but I am a bot, Jack
hello!
what is your name?
Jack
hello, Jack
how are you doing, Jack?
1. happy
2. sad
3. suicide
happy
thats aswesome, Jack
您没有收到提示,因为您没有要求任何输入,您可能想为 if else
定义一个基本情况print("hello!\n")
user_name = input("what is your name?\n")
print("hello, " + user_name + "\n")
mood = input("how are you doing? %s \n" % user_name)
if mood == "happy": print("thats aswesome,"+ user_name + "\n")
elif mood == "sad": print("Am sorry but am a botnet,"+ user_name + "\n")
elif mood == "suicide": print("1-800 ('national Suicide Prevention')"+ user_name + "\n")
else: print("Sorry I don't understand it")