Python Forum
visual studio code gives an error on Mint
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
visual studio code gives an error on Mint
#1
   

i don't know why,

it says some line of the code is erroneous
Reply
#2
next time please post code,

I have no problem with your code.

word =  input("enter a word: ")
print("Here's each letter in your word:")
for letter in word:
    print(letter)
Output:
enter a word: loop Here's each letter in your word: l o o p
Reply
#3
Look down in left corner you are running with python 2.7.15.
λ py -2.7
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> word = input("Enter a word: ")
Enter a word: loop
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
NameError: name 'loop' is not defined

# To fix it so it work Python 2
>>> word = raw_input("Enter a word: ")
Enter a word: loop
>>> word
'loop'
You should be using Python 3.6 -->.
Can click down in left and choose an other Python interpreter,it will show what Python interpreter it find on your system.
I have a tutorial here VS Code from start
Reply
#4
in python 2 use

word =  raw_input("enter a word: ")
Reply
#5
perfect
now i know how to further configure the program
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 877 Nov-15-2023, 06:56 PM
Last Post: jst
  How to set PYTHONPATH in Visual Studio Code? aupres 5 3,774 Aug-15-2023, 03:51 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 815 Jun-26-2023, 09:40 AM
Last Post: snippsat
  Visual Studio Code NewPi 3 985 May-16-2023, 11:13 PM
Last Post: snippsat
  Visual Studio Code venv ibm_db error mesi1000 7 2,663 Nov-13-2022, 12:36 AM
Last Post: snippsat
  debugging help on Visual Studio Code mg24 12 1,901 Oct-02-2022, 12:18 AM
Last Post: mg24
  Problem with importing Python file in Visual Studio Code DXav 7 4,912 Jun-15-2022, 12:54 PM
Last Post: snippsat
  Visual Studio Code Intellisense for Imported Modules Not Working hockinsk 1 2,650 Apr-23-2022, 04:41 PM
Last Post: deanhystad
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 6,689 Mar-02-2022, 01:23 AM
Last Post: tomtom
  compile error Visual Studio Code jamie_01 2 1,661 Jan-25-2022, 09:36 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020