HelloWorld

From CompSciWiki
Revision as of 19:26, 3 April 2012 by MaryAnnN (Talk | contribs)

Jump to: navigation, search

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.