Python for Beginners [6 of 44] Demo: Hello, World

Play Python for Beginners [6 of 44] Demo: Hello, World

The Discussion

  • User profile image
    diego

    I'm getting this message when I try to run the code, do you guys have the same problem?

    PS C:\Users\Diego\Desktop\intro to python> python helloworld.py
    python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + python helloworld.py
    + ~~~~~~
    + CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  • User profile image
    Patrick

    Hi Diego. Try 'py helloworld.py' or 'py -3 helloworld.py' not 'python helloworld.py'

  • User profile image
    blow
    thank you @patrick
  • User profile image
    Fritz

    I get the following error on Win 10 and OS X:

    PS C:\Users\ffrei\Documents\apyth> python hello.py
    What's your name? Fritz
    Traceback (most recent call last):
    File "hello.py", line 1, in <module>
    name = input("What's your name?")
    File "<string>", line 1, in <module>
    NameError: name 'Fritz' is not defined

  • User profile image
    taylorhuang
    @diego:
    did you add the python folder to your PATH environmental variable?
  • User profile image
    lohit92
    Would I be able to add a constant and a variable in a single print statement?
    e.g. Print('hello' Name) //This errored out.
    Expected Output Hello Susan.
  • User profile image
    piazi
    The internet is too slow here, so I will download it Pls.
  • User profile image
    DacoRoman

    I am getting the same error as Fritz

  • User profile image
    DacoRoman

    @Fritz:

    I found the cause for the NameError: I am using Python 2.7

    raw_input is the equivalent

    > python --version
    Python 2.7.10

  • User profile image
    Niner614961
    Python 2 is at its end of life. Please upgrade to Python 3 as soon as possible (even right now we're at the lovely looking Python 3.8 already :))

    If you cannot run 'python' (without quotes of course) it means that python isn't in your PATH
  • User profile image
    Michael2020
    In the newest version of VSC there is a run arrow in the top right hand corner which obviously runs the code you have open.

    My question is how do you suppress seeing the path of where the file and Python executable is located? Also why am I getting the % symbol? Below is an example.

    %
    dev@MBP PyRelated % /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /Users/dev/Documents/PyRelated/remove_lists.py
    [7, 21, 4, 5, 11, 5]
    [1, 4, 7, 1, 0]
    dev@MBP PyRelated %

Add Your 2 Cents

More episodes in this series

Related episodes