I am a python newcomer and have problem with executing my input code. My code is as follows:
userInput = input("Hi, What is your name? ")
print("Welcome {0}, Nice to meet you!".format(userInput))
Now the problem is that it runs perfectly fine in PyCharm 2020, yet when I try to run it in my Ubuntu 20.04's terminal, it returns the following error:
./userIO.py: line 7: syntax error near unexpected token `('
./userIO.py: line 7: `userInput = input("Hi, What is your name? ")'
I wonder what could the cause be. Can you please help me find what can cause the problem?
print(f"Welcome {userInput}, Nice to meet you!")as thefmakes it a formatted string. Note that it is note supported before Python 3. I dont know if it will fix your problem.python3 script.pyor justscript.py?