CH 1 Introduction To Python
CH 1 Introduction To Python
F.Y.B.Sc- Economics
Symbiosis School of Economics, Pune
Content
What is a Problem?
PROBLEM SOLVING
Problem solving is the systematic approach to define the problem and creating number of
solutions.
The problem solving process starts with the problem specifications and ends with a correct
program.
Algorithm & flow chart
ALGORITHM
It is defined as a sequence of instructions that describe a method for solving a problem.
In other words it is a step by step procedure for solving a problem
Should be written in simple English
Each and every instruction should be precise and unambiguous.
Instructions in an algorithm should not be repeated infinitely.
Algorithm should conclude after a finite number of steps.
Should have an end point
Derived results should be obtained only after the algorithm terminates.
Building Blocks of Algorithm
As algorithm is a part of the blue-print or plan for the computer program. An algorithm is constructed using
following blocks.
Statements
States
Control flow
Function
Statements
Statements are simple sentences written in algorithm for specific purpose. Statements may consists of
assignment statements, input/output statements, comment statements
Eg.Read the value of ‘a’ //This is input statement
Calculate c=a+b //This is assignment statement
Print the value of c // This is output statement
Algorithm for addition of two numbers using
function
Main function()
Step 1: Start
Step 2:Call the function add()
Step 3: Stop
sub function add()
Step1:Functionstart
Step2:Geta,bValues Step 3: add c=a+b Step 4: Print c
Step 5: Return
Flowchart
A graphical representation
of an algorithm. Flowcharts is a diagram made up of boxes, diamonds, and other shapes, connected by arrows.
Each shape represents a step in process and arrows show the order in which they occur.
S.No Name of Symbol Type Description
symbol
1. Terminal Oval Represent the start and
Symbol stop of the program.
Python is an easy to learn, powerful programming language. It has efficient high-level data
structures and a simple but effective approach to object-oriented programming. Python’s
elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal
language for scripting and rapid application development in many areas on most platforms.
Python is a widely used general-purpose, high level programming language. It was created
by Guido van Rossum in 1991 and further developed by the Python Software Foundation.
It was designed with an emphasis on code readability, and its syntax allows programmers
to express their concepts in fewer lines of code.
Features of Python
LANGUAGE FEATURES
Interpreted
Platform Independent
Free and Open Source
High-level Language
Simple
Embeddable
Robust:
Rich Library Support
Installation
https://www.anaconda.com/download
Steps to Install Python on Windows 10
Here we are providing the installation process of Python 3.11.2 on Windows
Run the Python Installer for how to install Python on the Windows downloads folder
Make sure to mark Add Python 3.11 to PATH otherwise you will have to do it explicitly. It will start
installing Python on Windows.
Install Python on MacOS
To install Python simply open the Terminal app from Application -> Utilities and enter the following command
brew install python3
To verify the installation enter the following commands in your Terminal app
python
pip3
Python Interpretation & compilation Python
Editor-IDE, Pycharm & Jupyter Notebook
Python is an interpreted language, which means the source code of a Python program is
converted into bytecode that is then executed by the Python virtual machine.
python program is first compiled and then interpreted. The compilation part is hidden from
the programmer thus, many programmers believe that it is an interpreted language. The
compilation part is done first when we execute our code and this will generate byte code
and internally this byte code gets converted by the python virtual machine(p.v.m)
according to the underlying platform(machine+operating system).
Practical Session
Thank You