Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Kindly explain this error
I am a beginner in python programming. Kindly help me to sort out the error. When I write the below code in IDLE it is giving me the right answer. But when I write it in Visual Studio Code editor it is giving me an error given below.

def add(x, y):
    print("Sum= ", (x+y))
C:/Users/user/AppData/Local/Programs/Python/Python37-32/python.exe c:/Users/user/Desktop/ File "<stdin>", line 1 C:/Users/user/AppData/Local/Programs/Python/Python37-32/python.exe c:/Users/user/Desktop/ ^ SyntaxError: invalid syntax
I have already run very basic codes in VSCode but still getting this error for this code. Please explain this. Thanks in advance.
There is nothing wrong with the code shown, how are you running the code within VSCode, that seems like it could be the problem.
The problem is Visual Studio, which nay not be set right for Pyrhon. (You may nweed the #!path to python version header)

It works fine in a regular script file.

For an IDE type interface, might wat to try Anaconda. Some folks recommend Eclipse. As a beginner also, I like to keep things simple, so use a text editor.
(Jul-16-2019, 05:32 AM)millpond Wrote: The problem is Visual Studio, which nay not be set right for Pyrhon.

There are two distinct products Visual Studio and Visual Studio Code (VS Code).

VS Code is very well suited for Python and for beginners.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Have a tutorial here VS Code from start.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Kindly asking for help with Pywinauto louloulou 0 228 Mar-05-2020, 06:55 PM
Last Post: louloulou

Forum Jump:

Users browsing this thread: 1 Guest(s)