HelloWorld

From CompSciWiki
Jump to: navigation, search

COMP 1010 Home > Back to Extra Labs

Introduction

To get 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.