SlideShare a Scribd company logo
1 of 32
Download to read offline
Topic #1
Preliminaries
Lecture 1 & 2
Najia Saher
Office hours
◦ Monday to Thursday 10:00 am - 1:00 pm and 2:00 pm - 3:00 pm ,
◦ Or by appointment (through email)
email: najia.saher@iub.edu.pk
Najia Saher, Programming Fundamentals, 2
 Course Website
https://sites.google.com/site/introprogramingc/
home
 Course Outline can be found on the website.
Najia Saher, Programming Fundamentals, 3
 Marks Distribution:
Programming
Assignments
5%
Quizzes 5%
Project 10%
Midterm 30%
Final 50%
Najia Saher, Programming Fundamentals, 4
 Fast Paced. Have to work hard (high fail rate if you don't)
 No spoon feeding, you have to try to learn yourself we are
here to help
 Surprise Quizzes
 Final Project/Home Assignments:
For the term Project students are required to work in a group of 3 to
4 students.
In every Assignment due date will be mentioned. All deliverables
(Assignments) are expected 100% on time. If the deliverable is not
submitted on due date, there will be a penalty of 20%. It will not be
accepted once the deliverable has been returned / discussed in
class. Please discuss any issues in a timely manner – no
consideration will be given at the end of the course.
Najia Saher, Programming Fundamentals, 5
 Computer
 Device capable of performing computations and
making logical decisions
 Computers process data under the control of sets
of instructions called computer programs
 Hardware
 Various devices comprising a computer
 Keyboard, screen, mouse, disks, memory, CD-ROM,
and processing units
 Software
 Programs that run on a computer
Najia Saher, Programming Fundamentals, 6
 Six logical units in every computer:
1. Input unit
 Obtains information from input devices (keyboard,
mouse)
2. Output unit
 Outputs information (to screen, to printer, to control
other devices)
3. Memory unit
 Rapid access, low capacity, stores input information
4. Arithmetic and logic unit (ALU)
 Performs arithmetic calculations and logic decisions
5. Central processing unit (CPU)
 Supervises and coordinates the other sections of the
computer
6. Secondary storage unit
 Cheap, long-term, high-capacity storage
 Stores inactive programs
Najia Saher, Programming Fundamentals, 7
Three types of programming languages
1. Machine languages
 Strings of numbers giving machine specific instructions
 Example:
+1300042774
+1400593419
+1200274027
2. Assembly languages
 English-like abbreviations representing elementary
computer operations (translated via assemblers)
 Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
Najia Saher, Programming Fundamentals, 8
Three types of programming languages
(continued)
3. High-level languages
 Codes similar to everyday English
 Use mathematical notations (translated via
compilers)
 Example:
grossPay = basePay + overTimePay
Najia Saher, Programming Fundamentals, 9
“Programming is about finding a systematic
way to manipulate some given data using a set
of instructions to achieve a required output".
Najia Saher, Programming Fundamentals, 10
 A program is a set of instructions that are
grouped together to accomplish a task or tasks.
 The instructions consist of task like reading
and writing memory, arithmetic operations, and
comparisons.
 Aim of a particular Program is to obtain
solution to a given problem.
 We can design a program by going through
the following first five major steps:
1. Analyze the program.
2. Design a solution/Program
3. Code/Enter the program
4. Test the program
5. Evaluate the solution.
Najia Saher, Programming Fundamentals, 11
 Analyze the program:
When we analyze a problem, we think about the requirements of the program
and how the program can be solved.
 Design a solution/Program:
This is the stage where we decide how our program will work to meet the
decision made during analysis. Program design does not require the use of a
computer. We can design program using pencil and paper. This is the stage
where algorithm are designed.
 Code/Enter the Program:
Here we enter the program into the machine by making use of suitable
programming language.
 Test the Program:
This part deals with testing of programs for various inputs and making necessary
changes if required. Testing cannot show that a program produces the correct
output for all possible inputs, because there are typically an infinite number
of possible inputs. But testing can reveal syntax errors, run-time problems and
logical mistakes.
 Evaluate The solution:
Thus, finally program can be implementing to obtain desired results.
Najia Saher, Programming Fundamentals, 12
Algorithm is the effective method to obtain
step by step solution of problems. Knowledge
of algorithm forms the foundation of study
programming languages. Before starting with
programming let us understand algorithm.
i.e. how to write algorithm, characteristic of
algorithm, algorithm designing tool and
conversion of algorithm to programs.
Definition:
An algorithm is defined as the finite steps
followed in order to solve the given problem.
Najia Saher, Programming Fundamentals, 13
To find the average score of a student for the
three test marks.
Step1: Start
Step2: Accept the three test marks s1,s2,s3
Step3: sum=s1+s2+s3
Step4: Average =sum/3
Step5: Display average
Step6: Stop
Najia Saher, Programming Fundamentals, 14
Algorithm must be designed in such a way that it is
followed by the pure top-down approach.
This will ensure the straight line execution of the
algorithm. An algorithm can be expressed or
designed in many ways.
One can make a use of any language to specify the
steps involved in solving a particular problem but
simple and precise language could be adopted. Two
famous ways of writing the algorithm are making use
of flowcharts and pseudo codes.
Algorithm Designing tools
Najia Saher, Programming Fundamentals, 15
 Flowchart is the diagrammatic way of representing,
the steps to be followed for solving the given
problem.
 Flowcharts proves the visualization of the steps
involved, since it is in the form of a diagram one
can understand the flow very easily. Here are some
diagrammatic symbols to design a flow chart.
Najia Saher, Programming Fundamentals, 16
START AND STOP
COMPUATIONAL
INPUT AND OUTPUT STATEMENTS
DECESION MAKING
CONNECTOR
FLOW INDICATOR
Najia Saher, Programming Fundamentals, 17
Najia Saher, Programming Fundamentals, 18
Pseudocode is an artificial and informal language that helps the
programmers to develop algorithm in the text format.
It allows the programmer to focus on the logic of the algorithm
without being distracted by details of the language syntax. It
narrates steps of the algorithm more precisely.
Following are the keywords used to indicate input, output and other
operations.
◦ Input – READ, GET
◦ Output – PRINT, DISPLAY
◦ Compute – CALCULATE, DETERMINE
◦ Initialize SET, INT
◦ Add one – INCREMENTER
◦ Sub one- DECREMENTER
Najia Saher, Programming Fundamentals, 19
 Pseudocode to obtain sum of two numbers.
BEGIN
INPUT X,Y
DETERMINE SUM = X+Y
PRINT SUM
END
 Pseudocode to obtain average of three numbers.
BEGIN
DISPLAY “INPUT 3 No’s”
INPUT X,Y,Z
DETERMINE SUM = X+Y+Z
DETERMINE AVG=SUM/3
PRINT AVG
END
Pseudocode-Exp
Najia Saher, Programming Fundamentals, 20
Basic programming consists of the following
two activities:
1. Coming up with a systematic way
(algorithm) of solving a problem. This part is
independent of a programming language (and
in fact of a computer).
2. Implementing that algorithm in
programming language like Python.
Najia Saher, Programming Fundamentals, 21
 Python, which was developed in the early
1990s by Guido van Rossum.
 High level language
 Easy to use and understand
 Python program can be run in an Integrated
 DeveLopment Environment (IDLE) or using a
text editor.
Najia Saher, Programming Fundamentals, 22
Najia Saher, Programming Fundamentals, 23
Najia Saher, Programming Fundamentals, 2019 24
 There are two ways to interact with Py(the Python
Interpreter)
1. Interactive Mode: The interpreter waits for you to
type Python statements on the keyboard. Once you
type a statement, the interpreter executes it and
then waits for you to type another statement.
2. Script Mode: he interpreter reads the contents of a
file that contains Python statements. Such a file is
known as a Python program or a Python script. The
interpreter executes each statement in the Python
program as it reads it.
Najia Saher, Programming Fundamentals, 25
 When the Python interpreter starts in interactive
mode, you will see something like the following
displayed in a console window:
 The >>> that you see is a prompt that indicates the
interpreter is waiting for you to type a Python statement.
Najia Saher, Programming Fundamentals, 26
 After typing the statement, you press the
Enter key, and the Python interpreter
executes the statement
 The >>> prompts appears again, Indicating the
interpreter is waiting for another statement.
Najia Saher, Programming Fundamentals, 27
Syntax Errors
 Something is wrong according to the rules of
the language, and the error is detected before
your program is actually run.
 You must fix the error and attempt to run the
program again.
Logical Errors
 It is a bug in a program that causes it to
operate incorrectly. (but it operates)
Najia Saher, Programming Fundamentals, 28
We have seen that basic programming consists
of the following two activities:
1. Coming up with a systematic way (algorithm) of
solving a problem. This part is independent of a
programming language (and in fact of a
computer).
2. Implementing that algorithm in a programming
language like Python.
Najia Saher, Programming Fundamentals, 29
 The tutor
http://pythontutor.com/composingprograms.html
 Shows the complete environment ( behind the
scenes)
Najia Saher, Programming Fundamentals, 30
 https://www.python.org/downloads/
 Download the python using the URL
Najia Saher, Programming Fundamentals, 31
Sections
 1.1-1.7
Najia Saher, Programming Fundamentals, 32

More Related Content

Similar to TOPIC-1-Introduction and Preliminaries.pdf

Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechzShahbaz Ahmad
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
 
C programming .pptx
C programming .pptxC programming .pptx
C programming .pptxSuhaibKhan62
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)TejaswiB4
 
Code tuning strategies
Code tuning strategiesCode tuning strategies
Code tuning strategiesAsha Sari
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow chartsChinnu Edwin
 
Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)praveena p
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2ITNet
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingHamad Odhabi
 

Similar to TOPIC-1-Introduction and Preliminaries.pdf (20)

Software development slides
Software development slidesSoftware development slides
Software development slides
 
10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz10th class computer science notes in english by cstechz
10th class computer science notes in english by cstechz
 
Computer
ComputerComputer
Computer
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
C programming .pptx
C programming .pptxC programming .pptx
C programming .pptx
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Code tuning strategies
Code tuning strategiesCode tuning strategies
Code tuning strategies
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow charts
 
grade 10 2023.pptx
grade 10 2023.pptxgrade 10 2023.pptx
grade 10 2023.pptx
 
Software development slides
Software development slidesSoftware development slides
Software development slides
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2
 
Cp 111 lecture 2
Cp 111 lecture 2Cp 111 lecture 2
Cp 111 lecture 2
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programming
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

TOPIC-1-Introduction and Preliminaries.pdf

  • 2. Najia Saher Office hours ◦ Monday to Thursday 10:00 am - 1:00 pm and 2:00 pm - 3:00 pm , ◦ Or by appointment (through email) email: najia.saher@iub.edu.pk Najia Saher, Programming Fundamentals, 2
  • 3.  Course Website https://sites.google.com/site/introprogramingc/ home  Course Outline can be found on the website. Najia Saher, Programming Fundamentals, 3
  • 4.  Marks Distribution: Programming Assignments 5% Quizzes 5% Project 10% Midterm 30% Final 50% Najia Saher, Programming Fundamentals, 4
  • 5.  Fast Paced. Have to work hard (high fail rate if you don't)  No spoon feeding, you have to try to learn yourself we are here to help  Surprise Quizzes  Final Project/Home Assignments: For the term Project students are required to work in a group of 3 to 4 students. In every Assignment due date will be mentioned. All deliverables (Assignments) are expected 100% on time. If the deliverable is not submitted on due date, there will be a penalty of 20%. It will not be accepted once the deliverable has been returned / discussed in class. Please discuss any issues in a timely manner – no consideration will be given at the end of the course. Najia Saher, Programming Fundamentals, 5
  • 6.  Computer  Device capable of performing computations and making logical decisions  Computers process data under the control of sets of instructions called computer programs  Hardware  Various devices comprising a computer  Keyboard, screen, mouse, disks, memory, CD-ROM, and processing units  Software  Programs that run on a computer Najia Saher, Programming Fundamentals, 6
  • 7.  Six logical units in every computer: 1. Input unit  Obtains information from input devices (keyboard, mouse) 2. Output unit  Outputs information (to screen, to printer, to control other devices) 3. Memory unit  Rapid access, low capacity, stores input information 4. Arithmetic and logic unit (ALU)  Performs arithmetic calculations and logic decisions 5. Central processing unit (CPU)  Supervises and coordinates the other sections of the computer 6. Secondary storage unit  Cheap, long-term, high-capacity storage  Stores inactive programs Najia Saher, Programming Fundamentals, 7
  • 8. Three types of programming languages 1. Machine languages  Strings of numbers giving machine specific instructions  Example: +1300042774 +1400593419 +1200274027 2. Assembly languages  English-like abbreviations representing elementary computer operations (translated via assemblers)  Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY Najia Saher, Programming Fundamentals, 8
  • 9. Three types of programming languages (continued) 3. High-level languages  Codes similar to everyday English  Use mathematical notations (translated via compilers)  Example: grossPay = basePay + overTimePay Najia Saher, Programming Fundamentals, 9
  • 10. “Programming is about finding a systematic way to manipulate some given data using a set of instructions to achieve a required output". Najia Saher, Programming Fundamentals, 10
  • 11.  A program is a set of instructions that are grouped together to accomplish a task or tasks.  The instructions consist of task like reading and writing memory, arithmetic operations, and comparisons.  Aim of a particular Program is to obtain solution to a given problem.  We can design a program by going through the following first five major steps: 1. Analyze the program. 2. Design a solution/Program 3. Code/Enter the program 4. Test the program 5. Evaluate the solution. Najia Saher, Programming Fundamentals, 11
  • 12.  Analyze the program: When we analyze a problem, we think about the requirements of the program and how the program can be solved.  Design a solution/Program: This is the stage where we decide how our program will work to meet the decision made during analysis. Program design does not require the use of a computer. We can design program using pencil and paper. This is the stage where algorithm are designed.  Code/Enter the Program: Here we enter the program into the machine by making use of suitable programming language.  Test the Program: This part deals with testing of programs for various inputs and making necessary changes if required. Testing cannot show that a program produces the correct output for all possible inputs, because there are typically an infinite number of possible inputs. But testing can reveal syntax errors, run-time problems and logical mistakes.  Evaluate The solution: Thus, finally program can be implementing to obtain desired results. Najia Saher, Programming Fundamentals, 12
  • 13. Algorithm is the effective method to obtain step by step solution of problems. Knowledge of algorithm forms the foundation of study programming languages. Before starting with programming let us understand algorithm. i.e. how to write algorithm, characteristic of algorithm, algorithm designing tool and conversion of algorithm to programs. Definition: An algorithm is defined as the finite steps followed in order to solve the given problem. Najia Saher, Programming Fundamentals, 13
  • 14. To find the average score of a student for the three test marks. Step1: Start Step2: Accept the three test marks s1,s2,s3 Step3: sum=s1+s2+s3 Step4: Average =sum/3 Step5: Display average Step6: Stop Najia Saher, Programming Fundamentals, 14
  • 15. Algorithm must be designed in such a way that it is followed by the pure top-down approach. This will ensure the straight line execution of the algorithm. An algorithm can be expressed or designed in many ways. One can make a use of any language to specify the steps involved in solving a particular problem but simple and precise language could be adopted. Two famous ways of writing the algorithm are making use of flowcharts and pseudo codes. Algorithm Designing tools Najia Saher, Programming Fundamentals, 15
  • 16.  Flowchart is the diagrammatic way of representing, the steps to be followed for solving the given problem.  Flowcharts proves the visualization of the steps involved, since it is in the form of a diagram one can understand the flow very easily. Here are some diagrammatic symbols to design a flow chart. Najia Saher, Programming Fundamentals, 16
  • 17. START AND STOP COMPUATIONAL INPUT AND OUTPUT STATEMENTS DECESION MAKING CONNECTOR FLOW INDICATOR Najia Saher, Programming Fundamentals, 17
  • 18. Najia Saher, Programming Fundamentals, 18
  • 19. Pseudocode is an artificial and informal language that helps the programmers to develop algorithm in the text format. It allows the programmer to focus on the logic of the algorithm without being distracted by details of the language syntax. It narrates steps of the algorithm more precisely. Following are the keywords used to indicate input, output and other operations. ◦ Input – READ, GET ◦ Output – PRINT, DISPLAY ◦ Compute – CALCULATE, DETERMINE ◦ Initialize SET, INT ◦ Add one – INCREMENTER ◦ Sub one- DECREMENTER Najia Saher, Programming Fundamentals, 19
  • 20.  Pseudocode to obtain sum of two numbers. BEGIN INPUT X,Y DETERMINE SUM = X+Y PRINT SUM END  Pseudocode to obtain average of three numbers. BEGIN DISPLAY “INPUT 3 No’s” INPUT X,Y,Z DETERMINE SUM = X+Y+Z DETERMINE AVG=SUM/3 PRINT AVG END Pseudocode-Exp Najia Saher, Programming Fundamentals, 20
  • 21. Basic programming consists of the following two activities: 1. Coming up with a systematic way (algorithm) of solving a problem. This part is independent of a programming language (and in fact of a computer). 2. Implementing that algorithm in programming language like Python. Najia Saher, Programming Fundamentals, 21
  • 22.  Python, which was developed in the early 1990s by Guido van Rossum.  High level language  Easy to use and understand  Python program can be run in an Integrated  DeveLopment Environment (IDLE) or using a text editor. Najia Saher, Programming Fundamentals, 22
  • 23. Najia Saher, Programming Fundamentals, 23
  • 24. Najia Saher, Programming Fundamentals, 2019 24
  • 25.  There are two ways to interact with Py(the Python Interpreter) 1. Interactive Mode: The interpreter waits for you to type Python statements on the keyboard. Once you type a statement, the interpreter executes it and then waits for you to type another statement. 2. Script Mode: he interpreter reads the contents of a file that contains Python statements. Such a file is known as a Python program or a Python script. The interpreter executes each statement in the Python program as it reads it. Najia Saher, Programming Fundamentals, 25
  • 26.  When the Python interpreter starts in interactive mode, you will see something like the following displayed in a console window:  The >>> that you see is a prompt that indicates the interpreter is waiting for you to type a Python statement. Najia Saher, Programming Fundamentals, 26
  • 27.  After typing the statement, you press the Enter key, and the Python interpreter executes the statement  The >>> prompts appears again, Indicating the interpreter is waiting for another statement. Najia Saher, Programming Fundamentals, 27
  • 28. Syntax Errors  Something is wrong according to the rules of the language, and the error is detected before your program is actually run.  You must fix the error and attempt to run the program again. Logical Errors  It is a bug in a program that causes it to operate incorrectly. (but it operates) Najia Saher, Programming Fundamentals, 28
  • 29. We have seen that basic programming consists of the following two activities: 1. Coming up with a systematic way (algorithm) of solving a problem. This part is independent of a programming language (and in fact of a computer). 2. Implementing that algorithm in a programming language like Python. Najia Saher, Programming Fundamentals, 29
  • 30.  The tutor http://pythontutor.com/composingprograms.html  Shows the complete environment ( behind the scenes) Najia Saher, Programming Fundamentals, 30
  • 31.  https://www.python.org/downloads/  Download the python using the URL Najia Saher, Programming Fundamentals, 31
  • 32. Sections  1.1-1.7 Najia Saher, Programming Fundamentals, 32