print("Hello Friend!")
myName = input("What is your name?")
print("Hello",myName)
myVar = input("How are you?")
if(myVar == "I'm good"):
print("I'm happy to hear that",myName,".")
elif(myVar == "I'm ok"):
print("I'm happy to hear that",myName,".")
elif(myVar == "I'm fine"):
print("I'm happy to hear that",myName,".")
else:
print("I'm sorry to hear that")
no1_Topic = input("What do you want to talk about?")
no2_Topic = input("Do you like",no1_Topic,"?")
if(no2_Topic == "Yes"):
print("Me too.")
elif(no2_Topic == "No"):
print ("Me neither")
这实际上是我的第一个自己的代码,我真的很想知道,我搞砸了什么。如果您只是通过一些微小的表达来评论修正后的版本,那么它也会很棒。我将尝试自己解决最多问题。哦,请原谅我的英语,我只有17岁,而不是母语人士。
答案 0 :(得分:1)
您遇到的错误是input
只会将一个可选字符串作为提示显示给用户。
而不是:
no2_Topic = input("Do you like",no1_Topic,"?")
使用字符串格式创建单个字符串:
no2_Topic = input('Do you like {}?'.format(no1_Topic))