Introduction to Python

From CompSciWiki
Revision as of 05:57, 4 April 2012 by MaryAnnN (Talk | contribs)

Jump to: navigation, search

COMP 1010 Home > Back to Extra Labs

Introduction

Python programming language was created by Guido Van Rossumin in the 1980's. It is a general purpose, object-oriented, expandable and described programming language. Python has an artistic syntax that allows its users to read code easily as well as understand the code. It is used for creation of web applications. Further, it has an inbuilt development environment called IDLE and a large library that supports huge projects. In this lab, you will be taught how to program in this very exciting programming language called Python. The medium in which you will learn this program is through getting to actually practice on your own. Furthermore, in this lab, I will translate some of the programs you may have seen in “Program a day “ that are written in Java programming language. Hope you enjoy this lab. Ouuups! Least I forget, you can get started by downloading python from www.python.org.

Installation

The following steps are used to install python

  • Log on www.python.org/download
  • Choose the appropriate version for your operating system

    Running Python programs

    Use the following steps to run all you Python programs

  • Type all Python programs in the IDLE environment
  • On the Run tab, click on Run Module or press F5

    Getting Started

    HelloWorld

    Primitive Data Types

    Area Calculation

    Wind Chill

    If/else/elif

    Calculate days in a month

    Grade Conversion

    While and for loops

    Convert a for loop to a while loop

    Conclusion

    Conclusion