SlideShare a Scribd company logo
Programming Principles
CMP 2421
Programming Principles
Four lectures a week for 14 weeks
Class: 12h30, Tuesday
12h30, Wednesday
09h30-11h25, Friday
Practical session: Thursday 16h30
Test: 2 minimum, assignment, presentation, Quiz
 Ms. Ntinda M.N
 Assistance: Mathe and Paulus
 Light talks (5 min max)
 Install:
 Windows OS
 Python 3….
 gedit
Day1
Is to teach you to think like a
computer Scientist
This way of thinking combines
some of the best features of
mathematics, engineering and
natural science
Goal
 Like Mathematicians, Computer scientists use formal
languages to denote ideas(Specifically computation)
 Like Engineers, they design things, assembling
components into systems and evaluating tradeoffs
among alternatives
 Like Scientists, they observe the behavior of complex
systems, form hypotheses and test predictions
Goal
Natural Language Formal Language
Full of ambiguity which people deal with
by using contextual clues and other
information
Designed to be nearly or completely
unambiguous, which means that any
statement has exactly one meaning,
regardless of context
In order to make up for ambiguity and
reduce misunderstanding, natural
languages employ lots of redundancy
Less redundant and more concise
Literalness are full of idiom and
metaphor
Mean exactly what they say
Natural language vs Formal
Language
 The single most important skill for a computer
Scientist is problem solving
Goal
 The ability to formulate problems, think creatively
about solutions and express a solution clearly and
accurately.
 The process of learning to program is an excellent
opportunity to practice problem solving skills
Problem Solving means:
 Is an artificial language used to write instructions that can
be translated into machine language and then executed by
a computer. Examples:
 Python
 Visual basics
 Java
 C#
 C++
 Pearl
What is a programming Language
 The programming Language you will be learning in
this course is Python
 Python is an example of a high level programming
language.
 Other High level programming languages:
 C,C++,Perl and Java
Programming Language
 There are also low-level programming languages,
sometimes referred to as “machine Languages” or
“Assembly languages”
 Example of low level programming Languages:
 Machine language and Assembly language
Programming Languages
Programming Languages
 High level enable a programmer to
write programs that are more or less independent of
a particular type of computer.
 Such languages are considered high-level because
they are closer to human languages and further
from machine languages.
 In contrast, assembly languages are considered low-
level because they are very close to machine
languages.
Define: High level language, Low
level languages
 Computers can only execute programs written in low
level languages.
 Programs written in high level language have to be
processed before they can run.
 This extra processing takes some time, which is a
small disadvantage of high level languages.
 A related meaning "to execute" refers to the specific
action of a user starting (or launching or invoking) a
program, as in "Please run the ... application.“
“RUN”
High level Low level
It is much easier to program Difficult to program
Takes less time to write, shorter
and easier to read and more likely
to be correct
Take longer to write and not easy
to read
Portable(they can run on
different kinds of computers with
or no modifications)
Low level programs can run on
only one kind of computer and
have to be rewritten to run on
another
High level vs low level languages
 Two kinds of programs process high-level languages
into low-level languages:
 Interpreters and Compilers
High-level program languages
 A compiler reads the program and translate it
completely before the program starts running.
Compiler
Compiler Object code
Executor Output
 In this case, a high-level language is called, a source
code and the translated program is called the object
code or the executable.
 Once a program is compiled, you can execute it
repeatedly without further translation
Compiler continue……
 An interpreter reads a high-level program and
executes it, meaning that it does what the program
says, it processes the program a little at a time,
alternatively reading times and performing
computations
Interpreter
OutputInterpreter
Source
Code
 Python is considered to be an interpreted language
because python programs are executed by an
interpreter
Interpreter
 A program is a sequence of instructions that specifies
how to perform a computation.
 The computation might be something mathematical
such as solving a system of equations or finding the
roots of a polynomial, but it can also be a symbolic
computation such as searching and replacing text in a
document
What Is a program?
 Input: get data from the keyboard, a file or some
other device
 Output: Display data on the screen or send data to a
file or other device
 Math: perform basic mathematical operations like
addition and multiplication
 Conditional execution:
 Check for certain condition and execute the appropriate
sequence of statement.
 Perform some repeatedly, usually with some variation
Every program you have ever used is
made up of the following
instructions:
 Programming is the process of breaking a large
complex task into smaller and smaller subtasks until
the subtasks are simple enough to be performed with
one of these basic instructions.
What is programming
 Programming is a complex process, and because it is
done by human beings, it often leads to errors.
 Python can only execute a program if the program is
syntactically correct otherwise the process fails and
returns an error message.
 Three kinds of errors
 Runtime errors
 Syntax errors
 Semantic errors
What is debugging
 Syntax refers to the structure of a program and the
rules about that structure.
 Example:
 In English, a sentence must begin with a capital letter
and end with a period.
 In English, you can be forgiven when you have a
grammatical error.
 Python is not forgiving
Syntax errors
 If there is a single error anywhere in your program,
python will print an error message and quit, and you
will not be able to run your program
 Learn your Syntax
 Beginners spend more time tracking errors, make use
of Google……with experience, you will make few
errors and track them down easier
Syntax errors cont……
 Runtime errors does not appear until you run the
program.
 These errors are also called exceptions because they
usually indicate that something exceptional(and bad)
has happened.
 Runtime errors are rare in the simple programs, you
will see in the first few examples you might not
encounter one
Runtime errors
 Occurs when the program run successfully, in the
sense that the computer will not generate any error
messages but it will not do the right thing.
 The program will do something else.
Semantic errors
 Example:
 We want to add 5+10 = 15 instead we add 3+10 = 13. 
 Identifying semantic errors can be tricky because it
requires you to work backward by looking at the
output of the program and trying to figure out what it
is doing
Semantic errors cont….
 Know how to debug
 For some people, debugging and programming is the
same thing.
 Programming is the process of gradually debugging a
program until it does what you want.
Debugging
 Command-line mode and script mode
 In command-line mode, you type python programs
and the interpreter prints the results
 In a script mode, you can write a program in a file and
use the interpreter to execute the contents of the
file. Such a file is called a script.
 Use a text editor to crate a file.
 As with MsWord file .doc,,,,,,,,python files end with
.py
There are two ways to use an
interpreter:
 Python is a very popular programming language that
can be used for creating websites, games, scientific
software, graphics
 Python originated in the late 1980s and its main goal
is to be readable by human beings (not only
machines!).
Python
 https://www.python.org/downloads/
 make sure you scroll down and choose the "Add
python.exe to the Path" option, as
 shown here:
 Type python in cmd to
 Confirm it was
 successfully installed
Download Python for Windows
from the website
 Gedit is an open-source, free editor, available for all
operating systems.
 http://ftp.gnome.org/pub/GNOME/binaries/win32/gedi
t/2.30/
 Why are we installing a code editor?
 Code needs to be plain text
 Problem with programs like Word and Textedit is that
they don't actually produce plain text, they produce rich
text (with fonts and formatting)
 Code editors provide helpful features, like highlighting
code with colour according to its meaning, or
Code editor: gedit
 command line or command-line interface
 is a text-based application for viewing, handling, and
manipulating files on your computer.
 Other names for the command line are:
cmd,CLI, prompt, console or terminal.
 Open the command-line interface
 Windows
 Go to Start menu → All Programs → Accessories →
Command Prompt.
 Prompt
 On Windows, it's a > sign, like this: command-line >
Introduction to the command-line
interface
 Current directory (know where we are)
 > cd
 C:Usersnntinda.UNAM.000
 List files and directories (what's in it?)
 > dir
 Directory of C:Usersnntinda.UNAM.000
 05/06/2015 07:28 PM <DIR> Applications
 05/06/2015 07:28 PM <DIR> Desktop
 05/06/2015 07:28 PM <DIR> Downloads
 05/06/2015 07:28 PM <DIR> Music ...
Basics: Each operating system has a slightly
different set of commands for the command
line
 Change current directory (let's go to Desktop directory)
 > cd Desktop
 PRO tip:
 if you type cd D and then hit tab on your keyboard,
the command line will automatically autofill the
rest of the name so you can navigate faster. If
there is more than one folder starting with "D", hit
the tab button twice to get a list of options.
Basics: Each operating system has a slightly
different set of commands for the command
line
 Create directory (folder) title: helloWorld
 > mkdir helloWorld
 PRO tip:
 If you don't want to type the same commands over and
over, try pressing the up arrow and down arrow on your
keyboard to cycle through recently used commands.
Basics: Each operating system has a slightly
different set of commands for the command
line
• Create a folder on your desktop called firstYearDiploma
• In your newly created firstYearDiploma directory create a
directory called name,20150999(student number).
Exercise

More Related Content

What's hot

Ch1 language design issue
Ch1 language design issueCh1 language design issue
Ch1 language design issue
Jigisha Pandya
 
Logical programming languages and functional programming languages
Logical programming languages and functional programming languagesLogical programming languages and functional programming languages
Logical programming languages and functional programming languages
nahianzarif
 
The Programmer Life Cycle
The Programmer Life CycleThe Programmer Life Cycle
The Programmer Life Cycle
Russell Ovans
 
Ppt 1
Ppt 1Ppt 1
Evolution and History of Programming Languages - Software/Hardware/System
Evolution and History of Programming Languages - Software/Hardware/SystemEvolution and History of Programming Languages - Software/Hardware/System
Evolution and History of Programming Languages - Software/Hardware/System
Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek parihar
Vivek Parihar
 
Notacd07
Notacd07Notacd07
Notacd07
Azmiah Mahmud
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
Ali Raza
 
Programing language
Programing languagePrograming language
Programing language
James Taylor
 
An overview of computers and programming languages
An overview of computers and programming languages An overview of computers and programming languages
An overview of computers and programming languages
Ahmad Idrees
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Cavite National Science High School
 
PROGRAMMING AND LANGUAGES
PROGRAMMING AND LANGUAGES  PROGRAMMING AND LANGUAGES
ICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesICT, Importance of programming and programming languages
ICT, Importance of programming and programming languages
Ebin Robinson
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
VIKAS SINGH BHADOURIA
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
Sangheethaa Sukumaran
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
NaqashAhmad14
 
Programming languages
Programming languagesProgramming languages
Programming languages
Archana Maharjan
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
Krishna Sai
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
eShikshak
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
Ashwini Awatare
 

What's hot (20)

Ch1 language design issue
Ch1 language design issueCh1 language design issue
Ch1 language design issue
 
Logical programming languages and functional programming languages
Logical programming languages and functional programming languagesLogical programming languages and functional programming languages
Logical programming languages and functional programming languages
 
The Programmer Life Cycle
The Programmer Life CycleThe Programmer Life Cycle
The Programmer Life Cycle
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Evolution and History of Programming Languages - Software/Hardware/System
Evolution and History of Programming Languages - Software/Hardware/SystemEvolution and History of Programming Languages - Software/Hardware/System
Evolution and History of Programming Languages - Software/Hardware/System
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek parihar
 
Notacd07
Notacd07Notacd07
Notacd07
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
Programing language
Programing languagePrograming language
Programing language
 
An overview of computers and programming languages
An overview of computers and programming languages An overview of computers and programming languages
An overview of computers and programming languages
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
PROGRAMMING AND LANGUAGES
PROGRAMMING AND LANGUAGES  PROGRAMMING AND LANGUAGES
PROGRAMMING AND LANGUAGES
 
ICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesICT, Importance of programming and programming languages
ICT, Importance of programming and programming languages
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
 

Similar to Cmp2412 programming principles

Python Intro Slides for Students CSC-148 Chapter 1
Python Intro Slides for Students CSC-148  Chapter 1Python Intro Slides for Students CSC-148  Chapter 1
Python Intro Slides for Students CSC-148 Chapter 1
Raza Ul Mustafa
 
Python Lecture 1
Python Lecture 1Python Lecture 1
Python Lecture 1
Inzamam Baig
 
Python programming
Python programmingPython programming
Python programming
noor_faiza
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
KPDDRAVIDIAN
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
AttaullahRahimoon
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ranjith kumar
 
Lecture 1-3.ppt
Lecture 1-3.pptLecture 1-3.ppt
Lecture 1-3.ppt
HafeezullahJamro
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
meisaina
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals
ArghodeepPaul
 
Contents Pre-requisites Approximate .docx
   Contents Pre-requisites  Approximate .docx   Contents Pre-requisites  Approximate .docx
Contents Pre-requisites Approximate .docx
ShiraPrater50
 
Specification Of The Programming Language Of Java
Specification Of The Programming Language Of JavaSpecification Of The Programming Language Of Java
Specification Of The Programming Language Of Java
Kim Moore
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
zaheeriqbal41
 
df
dfdf
Lecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python LanguageLecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python Language
National College of Business Administration & Economics ( NCBA&E)
 
Computer and Programming
Computer and Programming Computer and Programming
Computer and Programming
Mahsa Ch
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
Mohd Sajjad
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
Manohar k
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
Mukesh Tekwani
 

Similar to Cmp2412 programming principles (20)

Python Intro Slides for Students CSC-148 Chapter 1
Python Intro Slides for Students CSC-148  Chapter 1Python Intro Slides for Students CSC-148  Chapter 1
Python Intro Slides for Students CSC-148 Chapter 1
 
Python Lecture 1
Python Lecture 1Python Lecture 1
Python Lecture 1
 
Python programming
Python programmingPython programming
Python programming
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Lecture 1-3.ppt
Lecture 1-3.pptLecture 1-3.ppt
Lecture 1-3.ppt
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals
 
Contents Pre-requisites Approximate .docx
   Contents Pre-requisites  Approximate .docx   Contents Pre-requisites  Approximate .docx
Contents Pre-requisites Approximate .docx
 
Specification Of The Programming Language Of Java
Specification Of The Programming Language Of JavaSpecification Of The Programming Language Of Java
Specification Of The Programming Language Of Java
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
 
df
dfdf
df
 
Lecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python LanguageLecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python Language
 
Computer and Programming
Computer and Programming Computer and Programming
Computer and Programming
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 

Recently uploaded

Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 

Recently uploaded (20)

Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 

Cmp2412 programming principles

  • 2. Programming Principles Four lectures a week for 14 weeks Class: 12h30, Tuesday 12h30, Wednesday 09h30-11h25, Friday Practical session: Thursday 16h30 Test: 2 minimum, assignment, presentation, Quiz
  • 3.  Ms. Ntinda M.N  Assistance: Mathe and Paulus  Light talks (5 min max)  Install:  Windows OS  Python 3….  gedit Day1
  • 4. Is to teach you to think like a computer Scientist This way of thinking combines some of the best features of mathematics, engineering and natural science Goal
  • 5.  Like Mathematicians, Computer scientists use formal languages to denote ideas(Specifically computation)  Like Engineers, they design things, assembling components into systems and evaluating tradeoffs among alternatives  Like Scientists, they observe the behavior of complex systems, form hypotheses and test predictions Goal
  • 6. Natural Language Formal Language Full of ambiguity which people deal with by using contextual clues and other information Designed to be nearly or completely unambiguous, which means that any statement has exactly one meaning, regardless of context In order to make up for ambiguity and reduce misunderstanding, natural languages employ lots of redundancy Less redundant and more concise Literalness are full of idiom and metaphor Mean exactly what they say Natural language vs Formal Language
  • 7.  The single most important skill for a computer Scientist is problem solving Goal
  • 8.  The ability to formulate problems, think creatively about solutions and express a solution clearly and accurately.  The process of learning to program is an excellent opportunity to practice problem solving skills Problem Solving means:
  • 9.  Is an artificial language used to write instructions that can be translated into machine language and then executed by a computer. Examples:  Python  Visual basics  Java  C#  C++  Pearl What is a programming Language
  • 10.  The programming Language you will be learning in this course is Python  Python is an example of a high level programming language.  Other High level programming languages:  C,C++,Perl and Java Programming Language
  • 11.  There are also low-level programming languages, sometimes referred to as “machine Languages” or “Assembly languages”  Example of low level programming Languages:  Machine language and Assembly language Programming Languages
  • 13.  High level enable a programmer to write programs that are more or less independent of a particular type of computer.  Such languages are considered high-level because they are closer to human languages and further from machine languages.  In contrast, assembly languages are considered low- level because they are very close to machine languages. Define: High level language, Low level languages
  • 14.  Computers can only execute programs written in low level languages.  Programs written in high level language have to be processed before they can run.  This extra processing takes some time, which is a small disadvantage of high level languages.
  • 15.  A related meaning "to execute" refers to the specific action of a user starting (or launching or invoking) a program, as in "Please run the ... application.“ “RUN”
  • 16. High level Low level It is much easier to program Difficult to program Takes less time to write, shorter and easier to read and more likely to be correct Take longer to write and not easy to read Portable(they can run on different kinds of computers with or no modifications) Low level programs can run on only one kind of computer and have to be rewritten to run on another High level vs low level languages
  • 17.  Two kinds of programs process high-level languages into low-level languages:  Interpreters and Compilers High-level program languages
  • 18.  A compiler reads the program and translate it completely before the program starts running. Compiler Compiler Object code Executor Output
  • 19.  In this case, a high-level language is called, a source code and the translated program is called the object code or the executable.  Once a program is compiled, you can execute it repeatedly without further translation Compiler continue……
  • 20.  An interpreter reads a high-level program and executes it, meaning that it does what the program says, it processes the program a little at a time, alternatively reading times and performing computations Interpreter OutputInterpreter Source Code
  • 21.  Python is considered to be an interpreted language because python programs are executed by an interpreter Interpreter
  • 22.  A program is a sequence of instructions that specifies how to perform a computation.  The computation might be something mathematical such as solving a system of equations or finding the roots of a polynomial, but it can also be a symbolic computation such as searching and replacing text in a document What Is a program?
  • 23.  Input: get data from the keyboard, a file or some other device  Output: Display data on the screen or send data to a file or other device  Math: perform basic mathematical operations like addition and multiplication  Conditional execution:  Check for certain condition and execute the appropriate sequence of statement.  Perform some repeatedly, usually with some variation Every program you have ever used is made up of the following instructions:
  • 24.  Programming is the process of breaking a large complex task into smaller and smaller subtasks until the subtasks are simple enough to be performed with one of these basic instructions. What is programming
  • 25.  Programming is a complex process, and because it is done by human beings, it often leads to errors.  Python can only execute a program if the program is syntactically correct otherwise the process fails and returns an error message.  Three kinds of errors  Runtime errors  Syntax errors  Semantic errors What is debugging
  • 26.  Syntax refers to the structure of a program and the rules about that structure.  Example:  In English, a sentence must begin with a capital letter and end with a period.  In English, you can be forgiven when you have a grammatical error.  Python is not forgiving Syntax errors
  • 27.  If there is a single error anywhere in your program, python will print an error message and quit, and you will not be able to run your program  Learn your Syntax  Beginners spend more time tracking errors, make use of Google……with experience, you will make few errors and track them down easier Syntax errors cont……
  • 28.  Runtime errors does not appear until you run the program.  These errors are also called exceptions because they usually indicate that something exceptional(and bad) has happened.  Runtime errors are rare in the simple programs, you will see in the first few examples you might not encounter one Runtime errors
  • 29.  Occurs when the program run successfully, in the sense that the computer will not generate any error messages but it will not do the right thing.  The program will do something else. Semantic errors
  • 30.  Example:  We want to add 5+10 = 15 instead we add 3+10 = 13.   Identifying semantic errors can be tricky because it requires you to work backward by looking at the output of the program and trying to figure out what it is doing Semantic errors cont….
  • 31.  Know how to debug  For some people, debugging and programming is the same thing.  Programming is the process of gradually debugging a program until it does what you want. Debugging
  • 32.  Command-line mode and script mode  In command-line mode, you type python programs and the interpreter prints the results  In a script mode, you can write a program in a file and use the interpreter to execute the contents of the file. Such a file is called a script.  Use a text editor to crate a file.  As with MsWord file .doc,,,,,,,,python files end with .py There are two ways to use an interpreter:
  • 33.  Python is a very popular programming language that can be used for creating websites, games, scientific software, graphics  Python originated in the late 1980s and its main goal is to be readable by human beings (not only machines!). Python
  • 34.  https://www.python.org/downloads/  make sure you scroll down and choose the "Add python.exe to the Path" option, as  shown here:  Type python in cmd to  Confirm it was  successfully installed Download Python for Windows from the website
  • 35.  Gedit is an open-source, free editor, available for all operating systems.  http://ftp.gnome.org/pub/GNOME/binaries/win32/gedi t/2.30/  Why are we installing a code editor?  Code needs to be plain text  Problem with programs like Word and Textedit is that they don't actually produce plain text, they produce rich text (with fonts and formatting)  Code editors provide helpful features, like highlighting code with colour according to its meaning, or Code editor: gedit
  • 36.  command line or command-line interface  is a text-based application for viewing, handling, and manipulating files on your computer.  Other names for the command line are: cmd,CLI, prompt, console or terminal.  Open the command-line interface  Windows  Go to Start menu → All Programs → Accessories → Command Prompt.  Prompt  On Windows, it's a > sign, like this: command-line > Introduction to the command-line interface
  • 37.  Current directory (know where we are)  > cd  C:Usersnntinda.UNAM.000  List files and directories (what's in it?)  > dir  Directory of C:Usersnntinda.UNAM.000  05/06/2015 07:28 PM <DIR> Applications  05/06/2015 07:28 PM <DIR> Desktop  05/06/2015 07:28 PM <DIR> Downloads  05/06/2015 07:28 PM <DIR> Music ... Basics: Each operating system has a slightly different set of commands for the command line
  • 38.  Change current directory (let's go to Desktop directory)  > cd Desktop  PRO tip:  if you type cd D and then hit tab on your keyboard, the command line will automatically autofill the rest of the name so you can navigate faster. If there is more than one folder starting with "D", hit the tab button twice to get a list of options. Basics: Each operating system has a slightly different set of commands for the command line
  • 39.  Create directory (folder) title: helloWorld  > mkdir helloWorld  PRO tip:  If you don't want to type the same commands over and over, try pressing the up arrow and down arrow on your keyboard to cycle through recently used commands. Basics: Each operating system has a slightly different set of commands for the command line
  • 40. • Create a folder on your desktop called firstYearDiploma • In your newly created firstYearDiploma directory create a directory called name,20150999(student number). Exercise