Difference between revisions of "Introduction to Python"

From CompSciWiki
Jump to: navigation, search
(My previous change created a link to the Program-A-Day page in the introduction. Also re-worded the sentence.)
Line 5: Line 5:
 
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 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 the  creation of web applications. Further, it has an in-built development environment called IDLE and a large library that supports huge projects.  
 
It is used for the  creation of web applications. Further, it has an in-built development environment called IDLE and a large library that supports huge projects.  
In this lab, you will learn how to program in this very exciting programming language. Furthermore, we will translate some of the programs you may have seen in [[Program_a_day|Program-A-Day]] which are written in Java programming language into Python programming language. Hope you enjoy this lab.  
+
In this lab, you will learn how to program in this very exciting programming language. Furthermore, we will translate some Java programs you may have seen in [[Program_a_day|Program-A-Day]]. We will convert these Java programs into Python. Hope you enjoy this lab.  
  
  

Revision as of 18:16, 4 April 2012

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 the creation of web applications. Further, it has an in-built development environment called IDLE and a large library that supports huge projects. In this lab, you will learn how to program in this very exciting programming language. Furthermore, we will translate some Java programs you may have seen in Program-A-Day. We will convert these Java programs into Python. Hope you enjoy this lab.

Installing Python

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

    How to use while & for loops

    Conclusion

    In this lab, you were introduced Python programming language. We also translated solutions of some Program-A-Day problems which were written in Java programming language into solutions in Python programming language. Additionally, we talked primitive data types, if,elif,else conditional statements and loop control structures in Python. In the next lab, you will be introduced to more fun and interesting things about Python programming language.