PF Week1
PF Week1
PROGRAMMING
FUNDAMENTALS
SPRING (2023)
Lecture 1 &2
7TH March, 2024
Contact Hours
Credit Hours: 3(2,1)
2
Introduction
3
Let us start…
3
Introduction
4
Classroom Etiquette
All laptop computers, cell phones, tablet
computers must be closed during all classroom
hours
Introduction
5
Evaluation
Your evaluation in this course is based on four
components:
◦ One mid-term examination
◦ One final examination
◦ Assignments
◦ Quizes
Introduction
6
Evaluation
Commenting code is necessary for engineers:
◦ Engineers who do not comment code will not encourage
employees and contracted programmers to comment
their code.
◦ This will lead to significant additional costs.
Academic Offences
Academic Offences include, but are not limited to:
◦ Infringing unreasonably on the work of other members
● E.g., disrupting classes
◦ Cheating
◦ Plagiarism
◦ Misrepresentations
Introduction
11
Plagiarism
Collaboration with other students must be limited
to
◦ Discussions
◦ High-level pseudocode
◦ Assistance with debugging (only through the offering of
advice)
◦ Sharing test files
Plagiarism
When one student copies from another
student, both students are responsible
◦ Exceptions are made for outright theft
Distribution of Information
Information may be pass to the class through one
of two media:
◦ An announcement in class,
◦ Google or WhatsApp group
◦ An e-mail to CR
Introduction
14
Why Python?
Python is a particularly lucrative
programming language
16
Introduction
17
Why Python?
Python is used in machine learning &
artificial intelligence, fields at the
cutting-edge of tech
◦ Self-driving cars — Volkswagen
◦ Banking — JPMorgan Chase
◦ Healthcare — Philips
◦ Computer vision — Panasonic
◦ Cybersecurity — Palo Alto Networks
◦ Emotion detection — Affectiva
◦ Training — Deep learning
17
Introduction
18
Why Python?
Python is simply structured and easy to
learn
18
Introduction
19
Why Python?
Python has a really cool best friend: data
science
19
Introduction
20
Why Python?
Python creates amazing graphics
20
Introduction
21
Why Python?
There are countless free resources
available to Python programming
newbies
21
Introduction
22
What’s Programming?
22
Introduction
23
23
Introduction
What’s a Programming 24
Language?
Every programming language has a way to
write mathematical expressions, repeat a list
of instructions a number of times, choose
which of two instructions to do based on the
current information you have, and much
more. In this book, you’ll learn how to do
these things in the Python programming
language. Once you understand Python,
learning the next programming language will
be much easier.
24
Introduction
25
What’s a Bug?
The people who wrote the program told the
computer to do something it couldn’t do:
open a file that didn’t exist
keep track of more information than the
computer could handle
repeat a task with no way of stopping other
than by rebooting the computer
some bugs don’t cause a crash; instead, they
give incorrect information
25
Introduction
26
Installing Python
BEII 2021-2025 (google.com)
26
Chapter 2
Hello, Python
27
Introduction
How Does a Computer Run a 28
Python Program?
28
Introduction
29
Data Types
29
Introduction
30
Arithmetic Operators
30
Introduction
31
Operator Precedence
31
Introduction
32
32