运行以下代码后,python提示错误,并告诉我未定义名称“ tony”。
print('Hello Sam, this is Javis')
#let user enter their name, "nm" being the variable
nm = input('Please tell me your name => ')
print('It is definitely nice to meet you',nm,'!')
我输入的名字是“ Tony”
我做错了什么?
答案 0 :(得分:0)
由于要添加输入,因此需要使用“ +”而不是逗号。像这样:
print('It is definitely nice to meet you '+nm+'!')