Hello World in Python

Terry Reedy tjreedy at udel.edu
Sun Jan 25 02:12:51 CET 2015

On 1/24/2015 6:53 PM, Christopher J. Pisz wrote:
> I am trying to help a buddy out. I am a C++ on Windows guy. This buddy
> of mine is learning Python at work on a Mac. I figured I could
> contribute with non language specific questions and such.
> When learning any new language, I said, the first step would be a Hello
> World program. Let's see if we can get that to work.
> So my buddy creates opens the IDE they gave at the workplace, creates a
> new project, adds a demo.py file, writes one line : print "Hello World",
> hits Run in the IDE and indeed the display is shown at the bottom when
> it executes.
> I say the next step would be to get that to run on the command line. So
> (keep in mind I know nothing about macs) my buddy opens a "zsh?" window,
> cd to the directory, and I say the command i most likely: python demo.py
> It looks like it executes but there is no output to the command line
> window.

It should.  In a Windows console, using 3.4:
C:\Programs\Python34>type tem.py  # cat on Mac?
print('Hello World!')

C:\Programs\Python34>python tem.py
Hello World!

 > Can anyone explain why there is no output?

Without a copy of the file and command, as above, no.

 > Can anyone recommend a good walkthrough of getting set up and doing 

Since you used 2.x  print syntax: https://docs.python.org/2.7/

"Python Setup and Usage
how to use Python on different platforms"

start here"

 > I'll probably end up learning python myself, just to help out.

You might possibly enjoy Python as a complement to C++.  Some people 
prototype in Python and rewrite time critical functions in C++.  One can 
access .dlls either directly (via the ctypes module) and write a wrapper 
file in C or C++.  I believe Python has also been used to write tests 
for C++ functions (I know this is true for Python and Java, via Jython).

Terry Jan Reedy

More information about the Python-list mailing list