Difference between revisions of "HelloWorld"

From CompSciWiki
Jump to: navigation, search
m (Changed typo in conclusion (written) and intro (shown))
m (Switched from semicolon to colon "For students that like keyboard shortcuts: just press F5 and your program will output Hello World.")
Line 13: Line 13:
  
 
Save your file as '''HelloWorld.py''' as you would do in Java '''HelloWorld.java'''.
 
Save your file as '''HelloWorld.py''' as you would do in Java '''HelloWorld.java'''.
Finally, click on the Run tab in the IDLE environment. For students that like keyboard shortcuts; just press F5 and your program will output Hello World.
+
Finally, click on the Run tab in the IDLE environment. For students that like keyboard shortcuts: just press F5 and your program will output Hello World.
 
Congratulations!!! you have written you first Python program.
 
Congratulations!!! you have written you first Python program.
 
}}
 
}}

Revision as of 21:18, 4 April 2012

COMP 1010 Home > Back to Extra Labs

Introduction

In the process of getting started, we will write our first program in Python. The first program you wrote in Java was “Hello world” which contained at least 3 lines of Java code. In python programming language, the Hello world program is written in just one line of code. Also, Python programming language uses the file extension .py as compared to Java that uses the file extension .java. Shown below is our Hello world program.

Program:

 print "Hello World" 

Save your file as HelloWorld.py as you would do in Java HelloWorld.java. Finally, click on the Run tab in the IDLE environment. For students that like keyboard shortcuts: just press F5 and your program will output Hello World. Congratulations!!! you have written you first Python program.