Computer Science, asked by arhantdoongarwal, 8 months ago

I am currently learning coding through online course and I am using VISUAL STUDIO CODE as interpreter. I had this minor doubt concerned with coding.

python basics_1.py

File "", line 1

python basics_1.py

^

SyntaxError: invalid syntax

Although I have saved the file with codes in a folder, THIS IS THE OUTPUT I AM RECIEVING ON EXECUTING MY FILE IN PYTHON INTERACTIVE SHELL AND TERMINAL. NOTE: I am making use of terminal in visual studio code itself and I am not using cmd terminal. PLEASE HELP!!​

Answers

Answered by anirudhkp2004
0

Answer:

Syntax error

Explanation:

There is a syntax error in Line1 . syntax error means :

Syntax errors are the most basic type of error. They arise when the interpreter is unable to understand a line of code. ... In IDLE, it will highlight where the syntax error is. Most syntax errors are typos, incorrect indentation, or incorrect arguments.

In other words you are speaking a language to the computer (Interpreter) that it doesn't Understand.

Please check the indentation(spacing) after Colon(:)

OR

It may be a spelling mistakes in functions

OR

it can be wrong type of writing (identifier mistakes)

Go through the code to understand the mistakes.

Note: Making mistakes are sometimes Good for you.   : )

.

.

.

Happy Programming ^^

Answered by shuklaharshit432
0

Explanation:

Executing a python program in the terminal is a little different from running a program from an IDE (Integrated Desktop Environment).

After looking at the syntax error that you are encountering It seems like you are not taking the proper steps to run a code from the terminal.

On a terminal you do not need to start python before running a program.

Steps:

1. Open the terminal

2. Write

   python basics.py

An that should run the program directly.

Another advice that I would like to add is to run the python program

directly from visual studio code instead of using the terminal using the 'F5' button.

Although I think that you must be having a very proper reason for not using the visual studio code.

Similar questions