0

After running the below code, python prompt error and tell me name "tony" is not defined.

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,'!')

I input name as "Tony"

What did i do wrong?

  • When I run this code, I get `It is definitely nice to meet you tony !` – Prune Aug 20 '18 at 17:51
  • Similar question - https://stackoverflow.com/questions/21122540/input-error-nameerror-name-is-not-defined – Xnkr Aug 20 '18 at 17:51

1 Answers1

0

You need to use "+" Instead of commas since you're adding the input. like so:

print('It is definitely nice to meet you '+nm+'!')
Daniel Saggo
  • 108
  • 1
  • 9