I'm trying to run this Python program with Visual Studio Code:
# This Python program must be run with
# Python 3 as it won't work with 2.7.
ends the output with a <space>
print("Welcome to" , end = ' ')
print("GeeksforGeeks", end = ' ')
But while building I get following output and error messages in console:
$ python /home/mrrobot/Documents/Python/loop_while.py
File "/home/mrrobot/Documents/Python/loop_while.py", line 5
print("Welcome to" , end = ' ')
^
SyntaxError: invalid syntax
What could be the problem here? How can I fix it?
python
command, which in Ubuntu is still nearly always Python 2. Usepython3
instead and the program should work. – Eliah Kagan Aug 10 '20 at 07:49