Hello World in Spyder

From OpenCircuits
Revision as of 10:18, 6 January 2017 by Russ hensel (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview[edit]

It is a tradition that your first program simply print "Hello World" or in Python perhaps "Hello Universe" or "Hello Monty". In Python this is really easy:

print "Hello World"

So in this task you just want to get the above into a file and run it. Simple but how?

  • Open Spyder
  • Create a Project
  • Create a file, perhaps called hw.py
  • Run the file

Of course I have left out some details. Is there help out there on the web ( but like the Spyder install, this may be a good in person, in class activity )

Update[edit]

In Python 3 there has been a small update to print, it has been made a function. This just adds a pair of parenthesis to hello world. And it works fine in Python 2.7. So it is good to code this way, your code will be ready for the Python 3 upgrade.

print( "Hello World" )

It is also good to get acquainted with functions early in you programming life, they are meat and potatoes in the world of programming. More at Python Functions

Links[edit]