SlideShare a Scribd company logo
1 of 28
BCI1103 Computer Programming (SFK)
 To know basic information about computer programming
 To get familiar with algorithm, pseudo-code and flowchart
 To know computer programming language
BCI1103 Computer Programming (SFK)
 Computer programs, known as software, are instructions to the computer.
 Programming began in the 1940s, using memory addresses and machine code
directly.
 Older programs were “monolithic,” and ran from beginning to end.
 Programs are written using programming languages.
 Newer programs contain modules that can be combined to form programs.
BCI1103 Computer Programming (SFK)
BCI1103 Computer Programming (SFK)
1101101010011010
COBOL (COmmon Business Oriented Language)
FORTRAN (FORmula TRANslation)
BASIC (Beginner All-purpose Symbolic Instructional
Code)
Pascal (named for Blaise Pascal)
Ada (named for Ada Lovelace)
C (whose developer designed B first)
Visual Basic (Basic-like visual language developed by
Microsoft)
Delphi (Pascal-like visual language developed by
Borland)
C++ (an object-oriented language, based on C)
Java (an object-oriented language)
Python
 Algorithm, pseudo-code, flowchart
 Algorithm?  the list of instructions and rules that a computer needs to do to
complete a task
 Algorithm  pseudo-code or flowchart or both
 Pseudo-code?  a plain language description of the steps in an algorithm
 Flowchart?  a diagram that depicts a process, system or computer algorithm
BCI1103 Computer Programming (SFK)
 Task:
Write an algorithm to calculate an area based on a given width and length. The
area is width multiply length.
BCI1103 Computer Programming (SFK)
Pseudo-code:
Input: a width and a length
1. Calculate the area by multiplying the width and
length
2. Print out the area
Output: area
Input
Process
Output
 Task:
Write an algorithm to determine a student’s final grade and indicate whether it is
passing or failing. The final grade is calculated based on the average of four marks.
If the average mark is below than 50, the grade is FAIL and vice versa.
BCI1103 Computer Programming (SFK)
Pseudo-code:
Input: User enter Final Grade of students
1. Calculate Average
2. Check student mark if lower or higher than 50
Output: output fail or pass
 Task:
Write an algorithm to
calculate an area based on
a given width and length.
The area is width
multiply length.
BCI1103 Computer Programming (SFK)
Flowchart
Start
Enter width,
length
Area = width x
length
Print area
End
 Flowchart  symbols that
represent certain meaning
BCI1103 Computer Programming (SFK)
 Python  Thonny (IDE)
 Script  to write your code
 Shell  to execute the written code
 Variable  to view your variables name and value
BCI1103 Computer Programming (SFK)
BCI1103 Computer Programming (SFK)
Python Script
Write code in here
Shell
Input / Output
displayed here
Variables (name,
value)/ Help/ Notes
 Step 1: Create new file: click File  New  name your file
 Step 2: Write code in the script
 Step 3: Click File  Save or “ctrl+s”
 Step 4: Click Run to execute the code
BCI1103 Computer Programming (SFK)
 The output will be displayed in the Shell
BCI1103 Computer Programming (SFK)
BCI1103 Computer Programming (SFK)
Pseudo-code:
Input: width, length
1. area = width * length
2. print area
Output: area
BCI1103 Computer Programming (SFK)
 We cannot see the process on computer screen because the processes occur in
computer memory and CPU (the brain of computer).
 We can see the variables name and the values that have been executed.
 Program execution is ended when there is no more code after the last line.
BCI1103 Computer Programming (SFK)
 Computer program contain codes of instructions, telling computer what to do.
 The instructions are written by you as the programmer (a person writing
computer codes).
 The written instructions (codes) are stored in files (computer system).
 It is executed (start doing all the actions), when you open or execute the
program in computer system.
BCI1103 Computer Programming (SFK)
 How to write scripts to solve a problem?  do the step by step in flowchart and
pseudo-code
 The steps must be based on the logic to solve the problem.
 Logic Syntax and Semantic logic
 Syntax  formal rules - how valid instructions are written in a programming
language  the code must be written based on valid rules in the python (eg.:
print (“ “))
 Semantic  set of rules that determines the instruction’s meaning in a
programming languages  eg.: to calculate area, you need to have the width
and length value, you cannot write the area calculation before having the
values.
BCI1103 Computer Programming (SFK)
 Identifiers: to name variables
 Formed by combining letters, digits and underscore
 Case sensitive.
 2 categories:-
 Standard
 User-defined
BCI1103 Computer Programming (SFK)
 Identifiers: to name variables
 Formed by combining letters, digits and underscore
 Case sensitive.
 2 categories:-
 Standard
 User-defined
• print
• if
• else
• continue
• True
• False
• while
• break
………….. Python keywords  already have in python that
have specific function/instruction
BCI1103 Computer Programming (SFK)
 Identifiers: to name variables
 Formed by combining letters, digits and underscore
 Case sensitive.
 2 categories:-
 Standard
 User-defined
Programmer (you) can define it.
• width
• length
• area
• firstName
• lastName
The rules:
1. Variables can be a combination of letters in lowercase (a to z) or
uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like
myClass, var_1 and print_this_to_screen, all are valid example.
2. Cannot start with digit: 1var
3. Cannot use the python keywords.
4. Cannot use special symbols: ! @ # $ % ^ & * ( ).
5. Must be meaningful: first_Name, not nm;
BCI1103 Computer Programming (SFK)
BCI1103 Computer Programming (SFK)
 Identifiers: to name variables
 Formed by combining letters, digits and underscore
 Case sensitive.
 2 categories:-
 Standard
 User-defined
 Let’s analyze the program
BCI1103 Computer Programming (SFK)
BCI1103 Computer Programming (SFK)
What if?:
BCI1103 Computer Programming (SFK)
force = mass x gravity
volume = pi x height x radius2
What if?:
BCI1103 Computer Programming (SFK)
 https://www.programiz.com/python-programming
 https://www.tutorialspoint.com/python/index.htm
 https://www.w3schools.com/python/
BCI1103 Computer Programming (SFK)
BCI1103 Computer Programming (SFK)

More Related Content

Similar to Chapter 1 _ 2_IntroToProgramming.pptx

C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdf
ComedyTechnology
 
Lab 2Lab ObjectivesThe objective for this lab is to review.docx
Lab 2Lab ObjectivesThe objective for this lab is to review.docxLab 2Lab ObjectivesThe objective for this lab is to review.docx
Lab 2Lab ObjectivesThe objective for this lab is to review.docx
DIPESH30
 

Similar to Chapter 1 _ 2_IntroToProgramming.pptx (20)

Lecture 01 2017
Lecture 01 2017Lecture 01 2017
Lecture 01 2017
 
Unit 1 c - all topics
Unit 1   c - all topicsUnit 1   c - all topics
Unit 1 c - all topics
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdf
 
Lesson 1-3 Fundamentals of Programming.pptx
Lesson 1-3 Fundamentals of Programming.pptxLesson 1-3 Fundamentals of Programming.pptx
Lesson 1-3 Fundamentals of Programming.pptx
 
Chapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdfChapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdf
 
Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge
 
Introduction to programming c
Introduction to programming cIntroduction to programming c
Introduction to programming c
 
Stack-Based Buffer Overflows
Stack-Based Buffer OverflowsStack-Based Buffer Overflows
Stack-Based Buffer Overflows
 
FINAL.ppt
FINAL.pptFINAL.ppt
FINAL.ppt
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Complete c programming presentation
Complete c programming presentationComplete c programming presentation
Complete c programming presentation
 
Introduction to compiler development
Introduction to compiler developmentIntroduction to compiler development
Introduction to compiler development
 
Lab 2Lab ObjectivesThe objective for this lab is to review.docx
Lab 2Lab ObjectivesThe objective for this lab is to review.docxLab 2Lab ObjectivesThe objective for this lab is to review.docx
Lab 2Lab ObjectivesThe objective for this lab is to review.docx
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with Systemc
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 

Recently uploaded

Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...
Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...
Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Lisi Hocke
 
Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdf
 
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
Abortion Clinic In Pongola ](+27832195400*)[ 🏥 Safe Abortion Pills In Pongola...
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
微信号购买
微信号购买微信号购买
微信号购买
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...
Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...
Abortion Pill Prices Jane Furse ](+27832195400*)[🏥Women's Abortion Clinic in ...
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST API
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Rustenburg [(+27832195400*)] 🏥 Women's Abortion Clinic i...
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
[GRCPP] Introduction to concepts (C++20)
[GRCPP] Introduction to concepts (C++20)[GRCPP] Introduction to concepts (C++20)
[GRCPP] Introduction to concepts (C++20)
 

Chapter 1 _ 2_IntroToProgramming.pptx

  • 2.  To know basic information about computer programming  To get familiar with algorithm, pseudo-code and flowchart  To know computer programming language BCI1103 Computer Programming (SFK)
  • 3.  Computer programs, known as software, are instructions to the computer.  Programming began in the 1940s, using memory addresses and machine code directly.  Older programs were “monolithic,” and ran from beginning to end.  Programs are written using programming languages.  Newer programs contain modules that can be combined to form programs. BCI1103 Computer Programming (SFK)
  • 4. BCI1103 Computer Programming (SFK) 1101101010011010 COBOL (COmmon Business Oriented Language) FORTRAN (FORmula TRANslation) BASIC (Beginner All-purpose Symbolic Instructional Code) Pascal (named for Blaise Pascal) Ada (named for Ada Lovelace) C (whose developer designed B first) Visual Basic (Basic-like visual language developed by Microsoft) Delphi (Pascal-like visual language developed by Borland) C++ (an object-oriented language, based on C) Java (an object-oriented language) Python
  • 5.  Algorithm, pseudo-code, flowchart  Algorithm?  the list of instructions and rules that a computer needs to do to complete a task  Algorithm  pseudo-code or flowchart or both  Pseudo-code?  a plain language description of the steps in an algorithm  Flowchart?  a diagram that depicts a process, system or computer algorithm BCI1103 Computer Programming (SFK)
  • 6.  Task: Write an algorithm to calculate an area based on a given width and length. The area is width multiply length. BCI1103 Computer Programming (SFK) Pseudo-code: Input: a width and a length 1. Calculate the area by multiplying the width and length 2. Print out the area Output: area Input Process Output
  • 7.  Task: Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated based on the average of four marks. If the average mark is below than 50, the grade is FAIL and vice versa. BCI1103 Computer Programming (SFK) Pseudo-code: Input: User enter Final Grade of students 1. Calculate Average 2. Check student mark if lower or higher than 50 Output: output fail or pass
  • 8.  Task: Write an algorithm to calculate an area based on a given width and length. The area is width multiply length. BCI1103 Computer Programming (SFK) Flowchart Start Enter width, length Area = width x length Print area End
  • 9.  Flowchart  symbols that represent certain meaning BCI1103 Computer Programming (SFK)
  • 10.  Python  Thonny (IDE)  Script  to write your code  Shell  to execute the written code  Variable  to view your variables name and value BCI1103 Computer Programming (SFK)
  • 11. BCI1103 Computer Programming (SFK) Python Script Write code in here Shell Input / Output displayed here Variables (name, value)/ Help/ Notes
  • 12.  Step 1: Create new file: click File  New  name your file  Step 2: Write code in the script  Step 3: Click File  Save or “ctrl+s”  Step 4: Click Run to execute the code BCI1103 Computer Programming (SFK)
  • 13.  The output will be displayed in the Shell BCI1103 Computer Programming (SFK)
  • 14. BCI1103 Computer Programming (SFK) Pseudo-code: Input: width, length 1. area = width * length 2. print area Output: area
  • 15. BCI1103 Computer Programming (SFK)  We cannot see the process on computer screen because the processes occur in computer memory and CPU (the brain of computer).  We can see the variables name and the values that have been executed.  Program execution is ended when there is no more code after the last line.
  • 16. BCI1103 Computer Programming (SFK)  Computer program contain codes of instructions, telling computer what to do.  The instructions are written by you as the programmer (a person writing computer codes).  The written instructions (codes) are stored in files (computer system).  It is executed (start doing all the actions), when you open or execute the program in computer system.
  • 17. BCI1103 Computer Programming (SFK)  How to write scripts to solve a problem?  do the step by step in flowchart and pseudo-code  The steps must be based on the logic to solve the problem.  Logic Syntax and Semantic logic  Syntax  formal rules - how valid instructions are written in a programming language  the code must be written based on valid rules in the python (eg.: print (“ “))  Semantic  set of rules that determines the instruction’s meaning in a programming languages  eg.: to calculate area, you need to have the width and length value, you cannot write the area calculation before having the values.
  • 18. BCI1103 Computer Programming (SFK)  Identifiers: to name variables  Formed by combining letters, digits and underscore  Case sensitive.  2 categories:-  Standard  User-defined
  • 19. BCI1103 Computer Programming (SFK)  Identifiers: to name variables  Formed by combining letters, digits and underscore  Case sensitive.  2 categories:-  Standard  User-defined • print • if • else • continue • True • False • while • break ………….. Python keywords  already have in python that have specific function/instruction
  • 20. BCI1103 Computer Programming (SFK)  Identifiers: to name variables  Formed by combining letters, digits and underscore  Case sensitive.  2 categories:-  Standard  User-defined Programmer (you) can define it. • width • length • area • firstName • lastName The rules: 1. Variables can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like myClass, var_1 and print_this_to_screen, all are valid example. 2. Cannot start with digit: 1var 3. Cannot use the python keywords. 4. Cannot use special symbols: ! @ # $ % ^ & * ( ). 5. Must be meaningful: first_Name, not nm;
  • 22. BCI1103 Computer Programming (SFK)  Identifiers: to name variables  Formed by combining letters, digits and underscore  Case sensitive.  2 categories:-  Standard  User-defined  Let’s analyze the program
  • 24. BCI1103 Computer Programming (SFK) What if?:
  • 25. BCI1103 Computer Programming (SFK) force = mass x gravity
  • 26. volume = pi x height x radius2 What if?: BCI1103 Computer Programming (SFK)
  • 27.  https://www.programiz.com/python-programming  https://www.tutorialspoint.com/python/index.htm  https://www.w3schools.com/python/ BCI1103 Computer Programming (SFK)