Difference between revisions of "HelloWorld"

From CompSciWiki
Jump to: navigation, search
m (Completed this page)
m
Line 12: Line 12:
  
 
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 Helloworld. Congratulations!!! you have wrriten you first Python program.
+
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 wrriten you first Python program.
 
}}
 
}}

Revision as of 19:24, 3 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. Show 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 wrriten you first Python program.