PROGRAMMING FUNDAMENTALS
WEEK 01 – INTRODUCTION TO FUNDAMENTALS OF PROGRAMMING
Course Instructor : Engr.Asma Khan
WHY LEARN PROGRAMMING LANGUAGES??
1. What is programming?
2. Why programming is important
• Critical reading
• Analytical thinking
• Creative synthesis
3. What skills are needed?
• Paying attention to detail
• Think about the reusability.
• Think about user interface
• Understand the fact the computers are stupid
Computers are incredibly stupid. They do exactly what you
tell them to do: no more, no less-- unlike human beings.
Computers can't think by themselves
4.Develop a basic recipe for writing programs 2
PROGRAM TO CALCULATE THE AREA OF A CIRCLE:
3
RECIPE OF MAKING A PROGRAM
Hence to design a program properly, we must:
o Analyze a problem statement, typically expressed as a word problem.
o Express its essence, abstractly and with examples.
o Formulate statements and comments in a precise language.
o Evaluate and revise the activities in light of checks and tests and o Pay attention to
detail.
4
TRANSLATORS
There are two kinds of translators which are known as Interpreter and Compilers. These
translators translate our program which is written in C-Language into Machine language.
Interpreters translates the program line by line meaning it reads one line of program and
translates it, then it reads second line, translate it and so on. The benefit of it is that we get
the errors as we go along and it is very easy to correct the errors. The drawback of the
interpreter is that the program executes slowly .
The Compiler read the whole program and translates it into machine language completely.
The difference between interpreter and compiler is that compiler will stop translating if it finds
an error and there will be no executable code generated whereas Interpreter will execute all
the lines before error and will stop at the line which contains the error. So Compiler needs
syntactically correct program to produce an executable code.
5
DEBUGGER
Another important tool is Debugger. Every programmer should be familiar with it.
Debugger is used to debug the program i.e. to correct the logical errors. Using debugger
we can control our program while it is running. We can stop the execution of our program
at some point and can check the values in different variables, can change these values etc.
In this way we can trace the logical errors in our program and can see whether our
program is producing the correct results.
6
COURSE BOOKS & MATERIALS
10/8/2018 7
PROGRAMMING LANGUAGES
10/8/2018 8
PROGRAMMING LANGUAGES
10/8/2018 9
WHY PYTHON?
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines than some
other programming languages.
Python runs on an interpreter system, meaning that code can be executed as soon as it is
written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-orientated way or a functional way.
Python relies on indentation, using whitespace, to define scope; such as the scope of loops,
functions and classes. Other programming languages often use curly-brackets for this
purpose.
10/8/2018 10
HISTORY OF PYTHON
Python was conceptualized by Guido Van Rossum in late 1980s.
Rossum published the fisrt version of python code (0.9.0) in Feb 1991 in Netherland.
Python is derive from ABC programming language, which is a general purpose
programming language.
He has selected the name since he was a big fan of Monty Python’s Flying Circus.
10/8/2018 11
WHAT CAN PYTHON DO?
Python can be used on a server to create web applications.
Python can be used alongside software to create workflows.
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python can be used for rapid prototyping, or for production-ready software development.
10/8/2018 12
PROGRAMMING LANGUAGES & TRENDS (2018)
10/8/2018 13
WHAT COMES UNDER FUNDAMENTALS?
Copy Right - Asst. Prof. Syed Faisal Ali 10/8/2018 14
COURSE OUTLINE
Language
Introducti Definition Concepts Accessin
Fundamen on s
tals of data g data
Pointers accessin using
g pointers
Decision
If else conditions
Controls
1D and
Lists Concepts
2D List
While
Loops For loop
loop
Dictionari Operatio
Concept ns,
es Methods
Body of Writing of
Functions functions functions
Types of
File I/O Concept
filing
1D and
Arrays Concepts
2D arrays
Copy Right - Asst. Prof. Syed Faisal Ali 10/8/2018 15
PYTHON ADVANTAGES & DISADVANTAGE
Simple and Embeddabl
Extensible
Easy e
Weak in
Speed Mobile
Improved IOT Limitation Computing &
Extensive Browsers
Productivit Opportuniti
Libraries
y es
Design
Free and Simple
Object Restrictions
Readable Open
Oriented
Source Underdevelo
ped
Database
Portable Access
Layers
10/8/2018 16
PYTHON COMPARISON TO OTHER LANGUAGES
“Hello World Program in “Hello World Program in C+ “Hello World Program in Java
Python +
public class HelloWorld{
Print (“Hello World !”) #include<iostream> Public static void main (String[]
using namespace std; args)
“Hello World Program in C
int main() {
{ System.out.println(“Hello
#include<stdio.h>
print (“Hello World !”); World !”);
int main()
return 0; }
{
} }
print (“Hello World !”);
return 0;
}
17
INTRODUCTION TO PYTHON PROGRAMMING
Some commonly acknowledged
reasons
1. Short development time
2. Learning curve is not so steep as other languages
3. Anaconda is a big self contained Python distribution
4. Large library base
5. Runs on many platforms
10/8/2018 18
RESERVED WORDS IN PYTHON
and assert break class continue
def del elif else except
exec finally for from global
if import in is lambda
not or pass print raise
try while
return
10/8/2018 19
PYTHON INSTALLATION
Anaconda Continuum
framework https://www.anaconda.com/download/
Python interpreter
Pycharm IDE
https://www.python.org/downloads/
10/8/2018 20
END OF LECTURE – WEEK 01
10/8/2018 21