0% found this document useful (0 votes)
3 views19 pages

Lecture 1

The document provides an introduction to Python, covering its definition, advantages, and various applications in software development. It outlines Python's data types, basic operations, and the importance of its extensive support libraries and integration features. Additionally, it discusses some limitations of Python, such as speed and mobile computing challenges.

Uploaded by

The Kalam House
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views19 pages

Lecture 1

The document provides an introduction to Python, covering its definition, advantages, and various applications in software development. It outlines Python's data types, basic operations, and the importance of its extensive support libraries and integration features. Additionally, it discusses some limitations of Python, such as speed and mobile computing challenges.

Uploaded by

The Kalam House
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Getting Started with Python

Session-1

©Grant Thornton Bharat LLP. All rights reserved.


Agenda
1. What is Python?
2. Birth and Rise of Python
3. Links for the necessary software
4. GUI of Python: IDLE and Statistical
5. Python Notebooks
6. Anaconda Python Distribution
7. Expressions: Basic Idea
8. Constant Values: Numeric & Strings
9. Arithmetic: Operations and BODMAS
10. Common Mathematical functions
11. Conditions: Equality, Greater Than, Less Than, etc.
12. Function Calls: Introduction to Python Functions
13. Symbols & Assignment, Declaring Python Variables
14. Reserved Keywords
15. Naming a Variable: Generally accepted conventions

2 ©Grant Thornton Bharat LLP. All rights reserved.


What is Python?
What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level
built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or glue language to connect existing components
together.
• Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program
maintenance.
• Python supports modules and packages, which encourages program modularity and code reuse.
• The Python interpreter and the extensive standard library are available in source or binary form without
charge for all major platforms, and can be freely distributed.

4 ©Grant Thornton Bharat LLP. All rights reserved.


Why choose Python?
Why Choose Python?

• Extensible in C++ & C


• Versatile features
• Diversified application in the software development
• Fewer programming codes
• Gaming
• Interactive
• Web frameworks and applications
• Interpreted
• Language development
• Modular
• Prototyping
• Dynamic
• Graphic design applications
• Object-oriented
• Mathematics
• Portable
• Machine Learning
• High level
• Artificial Intelligence
• Scripting
• IOT
6 ©Grant Thornton Bharat LLP. All rights reserved.
Why Choose Python?

Extensive Support Libraries

1. String operations

2. Internet

3. Web service tools

4. Operating system interfaces and protocols

5. Data Manipulation

7 ©Grant Thornton Bharat LLP. All rights reserved.


Why Choose Python?

Integration Feature
1. Python integrates the Enterprise Application
Integration easy to develop Web services by invoking
COM or COBRA components.

2. It has powerful control capabilities as it calls directly


through C, C++ or Java via Python.

3. Python also processes XML and other mark-up


languages as it can run on all modern operating
systems through same byte code.

8 ©Grant Thornton Bharat LLP. All rights reserved.


Why Choose Python?

Improved Programmer’s Productivity

The language has extensive support libraries and clean


object-oriented designs that increase two to ten fold of
programmer’s productivity while using the languages like
Java, VB, Perl, C, C++ and C#.

9 ©Grant Thornton Bharat LLP. All rights reserved.


Why Choose Python?

Productivity
With its strong process integration features, unit testing
framework and enhanced control capabilities contribute
towards the increased speed for most applications and
productivity of applications. It is a great option for building
scalable multi-protocol network applications.

10 ©Grant Thornton Bharat LLP. All rights reserved.


Why not to choose Python?
Why not to Choose Python?
Weak in Mobile Computing

Gets Slow in Speed


Python executes with the help of an interpreter instead of the compiler, which
causes it to slow down because compilation and execution help it to work
normally

Run-time Errors
The Python language is dynamically typed so it has many design restrictions
that are reported by some Python developers. It is even seen that it requires
more testing time, and the errors show up when the applications are finally run.

Underdeveloped Database Access Layers


As compared to the popular technologies like JDBC and ODBC, the Python’s
database access layer is found to be bit underdeveloped and primitive.
However, it cannot be applied in the enterprises that need smooth interaction of
complex legacy data.

12 ©Grant Thornton Bharat LLP. All rights reserved.


Python Data Types
Python Data Types
Type STR

Numeric Types: int, float, complex

Sequence Types: list, tuple, range

Mapping Type: dict

Set Types: set, frozenset

Boolean Type: bool

Binary Types: bytes, bytearray, memoryview

14 ©Grant Thornton Bharat LLP. All rights reserved.


Setting the Data Types
Example Data Type
x = "Hello World" str
x = 20 int
x = 20.5 float
x = 1j complex
x = ["apple", "banana", "cherry"] list
x = ("apple", "banana", "cherry") tuple
x = range(6) range
x = {"name" : "John", "age" : 36} dict
x = {"apple", "banana", "cherry"} set
x = frozenset({"apple", "banana", "cherry"}) frozenset
x = True bool
x = b"Hello" bytes
x = bytearray(5) bytearray
x = memoryview(bytes(5)) memoryview

15 ©Grant Thornton Bharat LLP. All rights reserved.


Setting the Specific Data Types
Example Data Type
x = str("Hello World") str
x = int(20) int
x = float(20.5) float
x = complex(1j) complex
x = list(("apple", "banana", "cherry")) list
x = tuple(("apple", "banana", "cherry")) tuple
x = range(6) range
x = dict(name="John", age=36) dict
x = set(("apple", "banana", "cherry")) set
x = frozenset(("apple", "banana", "cherry")) frozenset
x = bool(5) bool
x = bytes(5) bytes
x = bytearray(5) bytearray
x = memoryview(bytes(5)) memoryview

16 ©Grant Thornton Bharat LLP. All rights reserved.


Data and Type Introspection Basics

Introspection is an act of self examination. In computer programming, introspection is the ability to


determine type or properties of objects at runtime. Python programming language has a large support of
introspection. Everything in Python is an object. Every object in Python may have attributes and methods. By
using introspection, we can dynamically inspect Python objects.

17 ©Grant Thornton Bharat LLP. All rights reserved.


Python Dir Function

The dir() function returns a sorted list of attributes and methods belonging to an object.

>>> dir(()) ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__',
'__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__',
'__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__',
'__sizeof__', '__str__', '__subclasshook__', 'count', 'index'] Here we see an output of the dir() function for a tuple object.
>>> print(().__doc__) tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable's items If the argument is a tuple,
the return value is the same object.

Our investigation showed that there is a __doc__ attribute for a tuple object.

18 ©Grant Thornton Bharat LLP. All rights reserved.


Practical

You might also like