MS Learn Python - code not running in Visual Studio (newbie)

Dominic Churchill 1 Reputation point
2021-01-13T05:15:14.67+00:00

Hi there,

I am new to programming and have started the Microsoft first steps with Python course. I have navigated the installation of Python (3.9), Visual Studio Code, the Python extension for Visual Studio and have started into some of the practice exercises.

I have tried to run some of the practice programs but am not having much success. To try and identify the source of the problem, I have copied the provided Microsoft code from one of the examples. The issues appear to be as far as I can tell from my extremely limited understanding:

  1. The program is not running/partially running; and
  2. The program is returning the following error: ValueError: invalid literal for int() with base 10:

Specifically, I have to run the program three times before it ends. I have attached a screen grab from the terminal output from the program.

My assumption is that this might have something to do with Visual Studio set up as the output from the Microsoft example code does not match the provided output.

Any assistance would be greatly appreciated. Cheers! 56072-2021-01-13.png

Community Center Not monitored
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2021-01-13T06:34:18.033+00:00

    Hi @Dominic Churchill ,

    The tags are related to Visual Studio, for your questions about Visual Studio Code, we suggest you post it to the GitHub-vscode forum where you would get support for this product. Thanks for your understanding.

    Sincerely,
    Anna

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

  2. Meenketan 1 Reputation point
    2021-01-24T05:19:27.243+00:00

    I am a newbie myself. And as far as my knowledge into it and the output which I see, it might be possible that you have created a file "calorie counter" in 'Hello' folder and trying to call it from the "calorie counter" folder. So it's picking up 2 different folders simultaneously.
    Try using a different folder and create a seperate file. this might help.

    P.S. Correct me ,if I am wrong. :-)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.