0
msg = ("HI")
print(msg)

Output in Terminal

PS C:\Users\Yumil\OneDrive\Desktop\Work\NewProjects> & C:/Users/Yumil/AppData/Local/Microsoft/WindowsApps/python3.10.exe
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print(msg)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'msg' is not defined
>>> & C:/Users/Yumil/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/Yumil/OneDrive/Desktop/Work/NewProjects/madlibs.py
  File "<stdin>", line 1
    & C:/Users/Yumil/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/Yumil/OneDrive/Desktop/Work/NewProjects/madlibs.py
    ^
SyntaxError: invalid syntax
>>>
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Yumil
  • 1

1 Answers1

0

You don't need to type anything in the terminal window.

Close it, and right click on the file/editor to run the complete code as a file.

Alternatively, type exit to get out of the Python REPL, then simply remove the starting & character from the command

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • When I right click > Run Python file on terminal I get NameError and SyntaxError – Yumil Oct 23 '22 at 16:51
  • The code you've posted has neither. The `>>>` means you are running a Python REPL. You need to type `exit` there. Then run **only** `python3.10.exe madlibs.py` at the `PS C:/...>` prompt, or use the run button - https://code.visualstudio.com/docs/python/python-tutorial#_run-hello-world – OneCricketeer Oct 24 '22 at 17:04