100% found this document useful (2 votes)
2K views18 pages

Introduction to Python Programming

Python was created in 1990 by Guido van Rossum. It is a dynamic programming language designed to be easy to learn and use. Some key features include clean, clear syntax with few keywords, being highly portable by running on almost any system, and using indentation rather than brackets to delimit blocks. Python code tends to be much shorter than languages like C++ and Java, improving productivity. It supports a variety of data types including lists, dictionaries, and objects. Classes and modules extend its functionality. Overall, Python is a versatile language suitable for tasks like web development, scripting, rapid prototyping, and more.

Uploaded by

rashed44
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views18 pages

Introduction to Python Programming

Python was created in 1990 by Guido van Rossum. It is a dynamic programming language designed to be easy to learn and use. Some key features include clean, clear syntax with few keywords, being highly portable by running on almost any system, and using indentation rather than brackets to delimit blocks. Python code tends to be much shorter than languages like C++ and Java, improving productivity. It supports a variety of data types including lists, dictionaries, and objects. Classes and modules extend its functionality. Overall, Python is a versatile language suitable for tasks like web development, scripting, rapid prototyping, and more.

Uploaded by

rashed44
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
  • Python Overview
  • Introduction
  • Features
  • Productivity
  • Usability
  • Python vs. Java
  • Python Basic
  • Variables and Types
  • Simple Data Types
  • High Level Data Types
  • Control Structures
  • Functions
  • Class
  • Modules
  • Conclusion

+

Python
[Link] ID:0910647044 MD. Mahabub Akram ID:0910

Introduction

Python is created in 1990 by Guido van Rossum


Python is a well worked out coherent dynamic programming language Designed to be easy to learn and master

1. Clean, clear syntax


2. very few keywords

Highly portable

1. runs almost anywhere


2. Uses machine independent byte-codes

Features

Clean syntax plus high-level data type


[Link] to fast coding

Uses white-space to delimit blocks

Variables do not need declaration


1. although not a type-less language

Productivity

Reduce development time


[Link] is 2-10x shorter that C, C++, Java

Improved program maintenance

[Link] is extremely readable

Less training [Link] is very easy to learn

Usability

Rapid prototyping
Web scripting Throw-way, ad hoc programming Steering scientific programming Extension language XML processing Database application

GUI application
A Glue language

Python vs. Java

Code 5-10 times more concise


Dynamic typing Much quicker development

[Link] compilation phase


[Link] typing

Python is slower but development is so much faster Python can be used with Java: Jython

Python Basic

Variable need no declaration


>>>a=1 >>>a 1

Variable name alone is an expression, so the result is printed Variables must be created before they can be used
>>>b Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> b NameError: name 'b' is not defined

Variables and Types

Objects always have a type


>>>a=1 >>>type(a) <type int> >>>a=hello >>>type(a) <type string>

Simple Data types

String
[Link] hold any data, including embedded NULLs [Link] using either single, double, or triple quotes
>>> s=Hi there
>>>s Hi there >>>s=Embedded quote >>>s Embedded qoute

Simple Data Types

Integer object implemented using C longs


Float types implemented using C doubles Long Integers have unlimited size

[Link] only be available memory


>>>long = 1L << 64 >> long ** 5 2135987035920910082395021706169552114602704522 3566527699470416078222197257806405500229620869 36576L

High Level Data Types

Lists hold a sequence of items


[Link] hold any object 2. Declared using square brackets
>>>l = [] #an empty list >>>[Link](1) >>>[Link](Hi there); >>>len(l) 2 >>>l [1, Hi there]

High Level Data Types

Dictionaries hold key-value pairs


[Link] called maps or hashes. Implemented using hash-table [Link] can any immutable objects, values

[Link] using braces


>>> d={} >>d[0]=Hi there >>d[foo]=1 >>>len(d) 2 >>>d[foo] 1

Blocks

Blocks are delimited by indentation


[Link] used to start a block [Link] or spaces may be used
>>> if 1:
print true true

Looping

The for statement loops over sequences


>>> for ch in hello: print ch h e l l o >>> for i in range(3): print i 1 2 3

Functions

Functions are defined with the def statement:


>>>def foo(bar): return bar >>>

This defines a trivial function named foo that takes a single parameter bar The function object can be called:
>>>foo(3) 3

Class

Class are defined using the class statement


>>>class Foo: def __init__(self): [Link]=1 def getMamber(self): return [Link] >>>

The constructor has a special name __init__,while a destructor uses __del__ The self parameter is the instance Classes are instantiated using call syntax
>>>f=Foo() >>>[Link]()

Modules

Most of pythons power comes from modules


Modules can be implemented either in Python, or in C/C++ Import statement makes a module available
>>>import string
>>> [Link]( [Hi, there] ) Hi there >>>

Thank You

+ 
Python 
MD.Rasheduzzaman 
ID:0910647044 
MD. Mahabub Akram 
ID:0910
+ Introduction 
Python is created in 1990 by Guido van Rossum 
Python is a well worked out coherent dynamic programming 
la
+ Features  
Clean syntax plus high-level data type 
 
1.leads to fast coding 
Uses white-space to delimit blocks 
Variabl
+ Productivity  
Reduce development time 
 
1.code is 2-10x shorter that C, C++, Java 
Improved program maintenance 
 
1.co
+ Usability 
Rapid prototyping 
Web scripting 
Throw-way, ad hoc programming 
Steering scientific programming 
Extension
+ Python vs. Java 
Code 5-10 times more concise 
Dynamic typing 
Much quicker development 
 
1.no compilation phase 
 
2.l
+ Python Basic  
Variable need no declaration 
 >>>a=1 
 >>>a 
 1 
Variable name alone is an expression, so the result is p
+ Variables and Types  
Objects always have a type 
 
>>>a=1 
 
>>>type(a) 
 
<type „int‟> 
 
>>>a=“hello” 
 
>>>type(a)
+ Simple Data types 
String 
 
1.May hold any data, including embedded NULLs 
 
2.Declared using either single, double, or t
+ Simple Data Types 
Integer object implemented using C longs 
Float types implemented using C doubles 
Long Integers have

You might also like