Chapter5 _Getting_Started_with_python_Numpy_Group
Chapter5 _Getting_Started_with_python_Numpy_Group
↙
01100101 01100001
CHAPTER-5 01110100 01101001
01101110 01100111
GETTING STARTED
WITH PYTHON 00100000 01000010
01110010 01110101
01110100 01100001
PRESENTED BY NUMPY
01101100 01101001
INTRODUCTIO
N TO
PYTHON
Python is basically a high-level programming language.
It is a dynamic and free open-source language in
nature. Moreover, it uses an interpreter for converting
the source code into machine code. Furthermore, it
supports both object-oriented programming as well as
procedure-oriented programming. It is such a language
that is highly readable and uses English keywords.
Conten Let’s begin
t
↙
1/
01110100 01100001 01101100 01101001
INTRODUCTIO
Guido Van Rossum developed Python in the February
01110011 01110100 00100000 01000001
1991. He developed it at the National Research
01001001
Institute for Mathematics and Computer Science in
N TO
the Netherlands.
BRUTALIST AI
object-oriented and high-level programming
language.
About the author
Guido van Rossum (born 31st January, 1956) is a Dutch
programmer. He is best known as the author of the Python
programming language, for which he is the "Benevolent Dictator
For Life" (BDFL), which means that he continues to oversee
Python development, making decisions when necessary. He
received a master's degree in Mathematics and Computer
Science from the University of Amsterdam in 1982. His brother
contributed in designing the typeface, used in the "Python
Powered" logo.
02 FEATURES
01000011 01110010 01100101 01100001
OF PYTHON
/
01110100 01101001 01101110 01100111
00100000 01000010 01110010 01110101
PRINCIPLES
01110100 01100001
Python 01101100
is a good programming language
beginners .It I also very famous for :-
01101001
for
AND DESIGN
01110011 01110100 00100000
1)simple programming syntax
01000001
01001001
2)code readability
OF BRUTALIST
The user can write and execute the program in a
much simpler way as compared to the other
AI
programming language .There are many features
of python :-
1)easy to learn :- Due to simple English and the easy syntax. This allows learners to
graph the language very quickly.
3)Interactive mode :- It is a command line she which gives immediate feedback for
each statement. While running previously fed statement in active memory
7) Dynamic type - language :- In python , the user does not need to define the data type
of each of the variable used in the code as by default , the system defines the data
type .Fir ex :- If a user enter two variable A=25 , B =10Then , when the sum 'a' and 'b' is
calculated , it will result in 35 . Then , system has by default defined the data type as
integer .
8) Completeness :- Support wide range of library
9)GUI programming support :- Graphical user interface can be made using a module such
as py qt5 , py qt4 , wx python or thinker in python.
03 LIMITATIONS OF
01000011 01110010 01100101 01100001
PYTHON
/
01110100 01101001 01101110 01100111
00100000 01000010
like the other 01110010
programming languages, Python also has 01110101
some limitations. Some of
IMPLEMENTATI
them are mentioned below:
01110100 01100001
Performance and Speed:-
01101100 01101001
ON AND
01110011
Python is 01110100
slower in execution as 00100000
compared to the other 01000001
programming languages
like Java and C++. This happens since the execution of Python program takes place
01001001
with the help of an interpreter, instead of a compiler. As a result, the Python code
FUTURE OF
is executed line by line, which slows down the speed and performance.
Simplicity:-
Python is one of the simplest programming languages, which can indeed be a
BRUTALIST AI
problem. Its syntax is very simple and makes a programmer more of a Python
person. As a matter of fact, the users becomes so accustomed to its features that
they might feel it tougher to learn or work on other programming languages.
Weak In Mobile Computing:-
Python is a very simple programming language. The developers always need to write mobile
apps in a particular programming language according to the mobile platform. the developers
prefer to use Python directly for developing mobile apps because of its slow speed. Thus, it is
very rarely used for apps development.
Application Portability:-
installation of a specific version of Python interpreter on the operating system is needed to run
the application on that platform. Thus, the developers face problems in porting the application
from one platform to another.
/
01110100 01101001 01101110 01100111
00100000 01000010 01110010 01110101
PRINCIPLES
1.
ns
01110100 01100001 01101100 01101001
Game Development Like Java and C++, Python also has various modules
and libraries that provide support to develop video and 3D games. For
AND DESIGN
example, PySoy is a cross- platform 3D game engine which enables the
01110011 01110100 00100000 01000001
users to develop interactive games. Some popular games which have
been built using Python are Civilization-IV, Disney's ToonTown Online,
01001001 Vega Strike, etc.
OF BRUTALIST
2. 2. Web Development It is one of the most astonishing applications of
Python. This is because Python comes up with a wide range of
AI
frameworks like Django, Flask, Bottle, and a lot more that provide ease to
developers. Furthermore, Python has inbuilt libraries and tools which
make the web development process completely effortless
3. Desktop GUI Python is an interactive programming language that
helps developers to create GUIs easily and efficiently. It has a huge list
of inbuilt tools like PyQT, kivy, wx Python, and many other libraries
like them to build a fully functional GUI in an extremely secure and
efficient manner.
/
01110100 01101001 01101110 01100111
00100000 01000010 01110010 01110101
IMPLEMENTATI
Computational thinking:- A problem solving approach
01110100 01100001 01101100 01101001
using concepts and ideas for computer science which also
ON AND
involves expressing solution to
01110011 01110100 00100000 01000001 those problems logically
which enable us to analyse using a computer and other
01001001
tools.
FUTURE OF
Decomposition:- it is the first stage in which big task or
Complex problems are broken down into smaller task
BRUTALIST AI
which help us to understand the entire process
Pattern Recognition:- it is the second stage in which we look
for similarities and differences within the problem so that we
can easily solve it
Algorithms:- The last and final final stage where step by step
instructions to be followed for finding the solution of the
problem
Decomposition For ex:- we have to find sum if all the numbers from 1
to 100 To make it easy we can do 1+2+3+4...................97+98+99+100
Algorithm:-Step-1 Start
Step-2 Sum the lowest and highest numbers
Step-3 find Number of terms and dividing the highest number by 2
Step-4 Multiply step 1 & step2
Step-5 Display the result
Step-6 Stop
06 PROBLEM
01000011 01110010 01100101 01100001
SOLVING
/
01110100 01101001 01101110 01100111
00100000 01000010
What is Problem Solving?01110010 01110101
IMPLEMENTATI
Problem solving is the process of identifying a problem, analyze
01110100 01100001 01101100 01101001
the problem, developing an algorithm for the identified problem
ON AND
and finally implementing the
01110011 01110100 00100000 01000001 algorithm to develop program.
01001001
Steps for problem solving
FUTURE OF
There are 4 basic steps involved in problem solving
• Analyze the problem
• Developing an algorithm
BRUTALIST AI
• Coding
• Testing and debugging
Steps for problem solving
There are 4 basic steps involved in problem solving
• Analyze the problem
• Developing an algorithm
• Coding
• Testing and debugging
There are many standard software testing methods used in IT industry such as
• Component testing
• Integration testing
• System testing
• Acceptance testing
What is Algorithm?
• A set of precise, finite and sequential set of steps written to solve a problem
and get the desired output.
• Algorithm has definite beginning and definite end.
• It lead to desired result in finite amount of time of followed correctly.
What are the points that should be clearly identified while writing Algorithm?
• The input to be taken from the user
• Processing or computation to be performed to get the desired result
• The output desired by the user
Representation of Algorithm
An algorithm can be represented in two ways:
• Flow chart
• Pseudo code
Flow chart
• Flow chart is visual representation of an algorithm.
• It's a diagram made up of boxes, diamonds and other shapes, connected by arrows.
• Each step represents a step of solution process.
• Arrows in the follow chart represents the flow and link among the steps.
Flow Chart Examples
Example 1: Write an algorithm to divide a number by
another and display the quotient.
Algorithm
Step 1: Input a two numbers and store them in num1
and num2 Step 2: Compute num1/num2 and store its
quotient in num3
Algorithm
Step 1: Input a number and store it to num.
Step 2: Compute num * num and store it in square.
Step 3: Print square.
Pseudo code
INPUT num
COMPUTE square = num*num
PRINT square
Flow of Control
An algorithm is considered as finite set of steps that are executed in a sequence. But
sometimes the algorithm may require executing some steps conditionally or repeatedly.
In such situations algorithm can be written using
• Sequence
• Selection
• Repetition
Selection
Selection in algorithm refers to Conditionals which means performing operations
(sequence of steps) depending on True or False value of given conditions. Conditionals
are written in the algorithm as follows:
If <condition> then
Steps to be taken when condition is true
Otherwise
Steps to be taken when condition is false
Algorithm, Pseudocode, Flowchart with Selection (Using if)
Examples
Example: write an algorithm, pseudocode and flowchart to
display larger between two numbers
Input, Process and Output Identification
INPUT: Two numbers to be compared
PROCESS: compare two numbers and depending upon True and False value of
comparison display result
OUTPUT: display larger no
Algorithm
STEP1: read two numbers in num1, num2
STEP 2: if num1 > num2 then
STEP 3: display num1
STEP 4: else
STEP 5: display num2
Pseudo code
INPUT num1, num2
IF num1 > num2 THEN
PRINT "num1 is largest"
ELSE
PRINT "num2 is largest"
ENDIF
Flow Chart:-
Repetition
• Repetition in algorithm refers to performing
operations (Set of steps) repeatedly for a given
number of times (till the given condition is true).
Repetition is also known as Iteration or Loop
Repetitions are written in algorithm is as
follows:
Pseudocode
SET count = 0
WHILE count<10
PRINT "Techtipnow"
Count = count + 1
END WHILE
FLOWCHART:-
Decomposition
• Decomposition means breaking down a complex problem into smaller sub problems to solve them
conveniently and easily.
• Breaking down complex problem into sub problem also means analyzing each sub problem in detail.
• Decomposition also helps in reducing time and effort as different subprograms can be assigned to
different experts in solving such problems.
• To get the complete solution, it is necessary to integrate the solution of all the sub problems once
done.
/
01110100 01101001 01101110 01100111
00100000 01000010 01110010 01110101
IMPLEMENTATI
01110100 01100001 01101100 01101001
ON AND
01110011 01110100 00100000 01000001
01001001
FUTURE OF
BRUTALIST AI
Working in Python
Python allows the user to perform the tasks in two different modes.
The Two Ways are :-
1. Interactive Mode
2. Script Mode
Interactive Mode:-
Interactive mode refers to the mode where the user is able to instantly
see the output, for the input given.
The moment when a command is typed in front of the Command
Prompt (>>>) and the 'Enter Key' is pressed, the output will appear
instantly on the next line of the Interactive screen.
Step 1Click IDLE (Python 3.8 32-bit) icon which is available on the Start
pop up screen.
OR
On the desktop
OR
If pinned to the taskbar.
Script Mode
Script mode refers to the mode where the user is
able to execute multiple commands or statements
simultaneously.
How to work in Script mode
Step 1Click IDLE(Python version 3.8 32-bit) icon
which is available on the Start pop up screen.
OR
On the Desktop
OR
If pinned to the Taskbar
Step 2
1. Click 'File’
2. Select New 'File’ An Untitled Window will appear.
This window provides the user a Platform to write
programs on it
Step 3
Type a Code in the 'Untitled' window to program file.
Step 4
1. Click 'File’.
2. Select 'Save As’.
Step 5
Select the File, where you want to save the Program File
on you Computer.
Step 6
Enter the File name (say Num) in the 'File name' text box.
Step 7
Click on 'Save' button.
The File will be saved in the system with the extension .py
(by default).
Why Script Mode?
Note:-
When you run a program, the output will be available on the Interactive window.