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
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
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