Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
input error help
#1


name = input("Enter Name: ")
print("Hello there "+name)

input("Press enter")
I'm encountering an error with this command. When I get the "Enter name" prompt and I enter
Me (Or anything else)
I get this error:
Error:
Traceback (most recent call last): File "G:\Python Saves\Tests\Hello.py", line 1, in <module> name = input("Enter Name: ") File "<string>", line 1, in <module> NameError: name 'Me' is not defined
However, if I enter
"Me" instead, it works. I know it should work without "" but for some reason, it doesn't.
Can anyone help me out with this?

I am running on windows 10.
Reply
#2
Use code tag BBcode help.

You are getting that error because you use Python 2.
Fix:
name = raw_input("Enter Name: ")
print("Hello there " + name)
But you should really use Python 3,follow Python 3.6 and pip installation under Windows.
Then it can look like this.
name = input("Enter Name: ")
print(f'Hello there {name}')
Reply
#3
I see. I downloaded python 3 but it would seem I was using an old installation. I guess that is a newbie for you haha, thank you so much.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error in Using INPUT statement gunwaba 1 2,015 Jul-03-2022, 10:22 PM
Last Post: deanhystad
Star I'm getting syntax error while using input function in def. yecktmpmbyrv 1 1,932 Oct-06-2021, 09:39 AM
Last Post: menator01
  Pyspark SQL Error - mismatched input 'FROM' expecting <EOF> Ariean 3 47,824 Nov-20-2020, 03:49 PM
Last Post: Ariean
  EOF error while taking input ShishirModi 1 2,532 Sep-27-2020, 11:28 AM
Last Post: jefsummers
  Input Error Dream 2 2,397 Jul-12-2020, 05:41 PM
Last Post: bowlofred
  Getting an error while using input function dcsethia 5 2,854 May-11-2020, 04:59 PM
Last Post: buran
  catch input type error mcmxl22 5 2,967 Aug-11-2019, 07:33 AM
Last Post: wavic
  inserting input gives me error message RubberNuggets 3 2,504 Jan-15-2019, 06:17 PM
Last Post: buran
  an input error or elif error , how can i fix this the_fire_pharaoh 1 2,322 Dec-15-2018, 09:47 PM
Last Post: Gribouillis
  Getting Error : User Input aankrose 1 2,977 Sep-06-2018, 04:55 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020