Do I need to install PowerShell?+ Why is the name not defined?

Asked 1 years ago, Updated 1 years ago, 434 views

I'm a beginner in programming.

I participated in the workshop and decided to use the list named results.The instructor shared the list on Google Collaboration, so the first thing I copied the list to VSCode is the image.
I tried to print the list before trying this and that, but the following explanation came up.

In Install the latest PowerShell for new features and improvements!https://aka.ms/PSWindows
②NameError: name 'results' is not defined

About に
Do I need to install powershell?If necessary, the results of the execution will be displayed later, so I feel like I'm being asked to do so even though it's not very important.There was a website that explained how to install it, but I couldn't find anything that explained the necessity properly.I would appreciate it if someone could let me know as it is a disturbing phrase every time it appears.

About に
If you copy to JupiterNotebook, you can run it normally, but they don't recognize it as VSCode. Why?As for the name error, I don't know the cause of the error.

I installed ANACONDA on Windows 11 and I use VSCode and JupiterNotebook.I installed them this month, so they are all up to date.VSCode shows Python version 3.9.12.Thank you for your cooperation.Trying to copy and print a list

python powershell anaconda3

2022-10-07 01:00

1 Answers

VSCode does not have any extensions installed or configured for Python, or the target language does not appear to be Python when you create and save a new file.

は is independent of Python and has nothing to do with it.Apart from this case, please decide the distinction between necessity and necessity based on the conditions of other related things and things you want to do.
By the way, even if you update it to the latest version, the copyright notice and some message will be displayed by default.
The current (or latest) version will be hidden if -NoLogo is specified as the boot option.
about_PowerShell_exe

There is a high possibility that は is caused by the fact that the target file is set up and recognized as a script in a different language such as PowerShell instead of Python.

--Note: Regarding ②--
"Maybe they are doing ""Run Cursor Row at Terminal"" in the article below."

Run cursor lines in the terminal

Are you not running results=[...]] from the first line, only the print(results) line is running with the Shift + Enter key?
In that case, results are not defined, so you may encounter a question-like error.

Run the selection in the terminal above the above article Select all using the Shift + Enter key, or save your edits to a text file with the extension .py and on ref="https://www.python.jp/python_vscode/windows/run/exec_in_terminal.html#%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%A7Python%E3%82%92%E5%AE%9F%E8%A1%8C" rel="nofollow noreferrer"> terminal.
--End of postscript--

Please refer to this article to see if they are being carried out, and if there is a shortage, please work on them.
If you don't understand or have a word or content you don't know, you can search the web.
There's a lot more information on the web.

How to set Visual Studio Code for Python
[VSCode]How to change and verify file types and settings|extensions, indentation, etc.
Create a new file/Save the file

For example, a Windows PowerShell command prompt shortens the question and tries it directly:This is from PowerShell 5.1 on Windows 10, but the question の will correspond to the line "New Cross-Platform…" below.The question display is probably due to the fact that PowerShell's 6th to 7th series are being used.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PSC:\Users\UserName>results=[['Calabria', 50.8],
>>['Sardinia', 53.17]]
results —The term 'results' is recognized as the name of a cmdlet, function, script file, or operational program.
No, make sure the name is written correctly, and if it contains a path, make sure it is correct, then try again.
Please give me。
Location line: 1 character: 1
+ results = [['Calabria', 50.8],
+ ~~~~~~~
    + CategoryInfo: ObjectNotFound: (results: String) [ ], CommandNotFoundException
    + Fully QualifiedErrorId—CommandNotFoundException

PSC:\Users\UserName>


2022-10-07 01:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.