Difference between revisions of "HelloWorld"

From CompSciWiki
Jump to: navigation, search
m
m (Changed typo in conclusion (written) and intro (shown))
Line 2: Line 2:
 
|Chapter_TOC=[[Extra Labs]]
 
|Chapter_TOC=[[Extra Labs]]
 
|Introduction=In the process of getting started, we will write our first program in Python.
 
|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.
+
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.
  
 
|Body=
 
|Body=
Line 14: Line 14:
 
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 wrriten you first Python program.
+
Congratulations!!! you have written you first Python program.
 
}}
 
}}

Revision as of 21:14, 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.