Search code examples
pythonstringvariablesinputcomments

hi how do get the user to responed back,printstatment but its not allowing me to responed back


print("hello!\n")

user_name = input("what is your name?\n")

print("hello, " + user_name + "\n")

print("how are you doing?\n")

print(+ user_name + "\n")

good = "happy"

good = "sad"

good = "suicide"

if good != "happy ": print("thats aswesome,"+ user_name + "\n")

elif good == "sad": print("Am sorry but am a botnet,"+ user_name + "\n")

elif good == "suicide": print("1-800 ('national Suicide Prevention')"+ user_name + "\n")


Solution

  • You are not getting a prompt back because you did not ask for any input, and you might want to define a base case for 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")