SlideShare a Scribd company logo
UNIT 3
ALGORITHM &
PROGRAMMING
Created by Mr. Nidal Saleh
Recall from previous session
 Function: also known as method/procedure which
is a set of commands that can be called again and
over again.
 Benefits of Function?
 Define Function then Call the Function to Execute
 Define one function inside another function
 Function is a form of Abstraction finding one
solution for multiple problems.
 Function use Top Down approach breaking down
big problems to sub problems.
LESSON OBJECTIVES
Students will:
 Learn to read App Lab’s API documentation
 Use functions that accept parameters in order
to complete a series of drawing puzzles
 Design a personal monogram making use of
the commands you learned during the lesson
 Activity: Demonstrate your knowledge in
Practice
L7: API & Functions with
Parameter
Discussion Board on D2L
 What makes a Programmer?
1. Reading Documentation
2. Learn by seeing examples of a language
3. Professional programmers will frequently
reference documentation while designing
software
4. Learning habits of mind and patterns that
allow you to use a language (including its
documentation) effectively
5. Practice makes you a perfect programmer
L7: API & Functions with
Parameter
 API (Application Programming Interface) is a collection
of commands used to build applications.
 Functions have parameters which are information that
customize and control the behavior of a function.
 For example, you can specify moveForward(103) to move
the turtle exactly 103 pixels
 Library collection of functions with shared purpose.
 Documentation: A description of the behavior of a
function
 Since parameter value can change, you will often see a written
description for the command. Example:
moveForward(distance), turnLeft(angle) -
drawRectangle(sideLength, width).Code.org
Code.org
L7: API & Functions with
Parameter
 App Lab has documentation: look up
documentation about the commands of the language
penColor(), penWidth() dot(), arcLeft(), arcRight(),
moveTo(), turnTo()
Hexadecimal
penColor(“#FF0099”)
Students are asked read documentation
about all the new commands.
Watch Video
L7: Activity 1 to 13 on Code.org
 Design a personal monogram making use of
the commands you learned during the lesson
 Share your image & Upload to D2L
Draw whatever you like!
The only requirements are:
• use at least 3 different colors
• use moveTo
Explore the documentation for any new
commands you see and use your skills as
both an artist and user of API
documentation to draw something of
your own choosing.
If in doubt: try to re-create
"I [heart] CS" drawing
shown here.
Learning Objectives
 Identify situations for creating functions with
parameters.
 Incorporate functions with parameters into an
"Under the Sea" digital scene.
 Test functions with parameters using random
input.
L8: Creating Functions with Parameters
Watch Video
L8: Creating Functions with
Parameters
 What are the benefits of creating Functions with
Parameters?
1. Control behavior of the function – Customize it
for user needs.
2. Create complex drawings.
3. Can generalize solutions to problems instead of
duplicating code.
4. Offers extra flexibility - removes the need to
create multiple functions that do almost the same
thing. – Remove repetition and patterns
5. Easily experiment with different inputs to see
what kind of output we can produce.
Watch Video D2L Discuss & Share
 Defining multiple functions to draw different
sized squares results in lots of repetitive
functions .
 Any time you find yourself effectively copy and
pasting large sections of code, it's usually a
sign that there is a better way.
L8: Creating Functions with
Parameters
L8 Activity 1 to 14 on Code.org
 Modify the program that creates an “Under the
Sea” scene by adding parameters to functions.
 Use the random number functions to supply
random values to function calls so the scene
looks a little different every time the program
runs.
Example: randomNumber(0,3) to randomize
image so that every time your run program you
get different scenes like below:
Recap from this session
 What is an API
 How to create a function with parameter
 How to become a good programmer
 Benefit of creating functions with parameters

More Related Content

What's hot

compiler vs interpreter
compiler vs interpretercompiler vs interpreter
Computer programming project 15sec
Computer programming project 15secComputer programming project 15sec
Computer programming project 15sec
Jenny Brown
 
Language translator
Language translatorLanguage translator
Language translator
asmakh89
 
Compilation v. interpretation
Compilation v. interpretationCompilation v. interpretation
Compilation v. interpretation
Alexander Bollbach
 
TensorFlow Lite for mobile & IoT
TensorFlow Lite for mobile & IoT   TensorFlow Lite for mobile & IoT
TensorFlow Lite for mobile & IoT
Mia Chang
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
baabtra.com - No. 1 supplier of quality freshers
 
Introduction
IntroductionIntroduction
Introduction
Kamran
 
Python Lecture 1
Python Lecture 1Python Lecture 1
Python Lecture 1
Inzamam Baig
 
Introduction to compiler interpreter
Introduction to compiler interpreterIntroduction to compiler interpreter
Introduction to compiler interpreter
poojapainter
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
Cma Mohd
 
Interpreted and compiled language
Interpreted and compiled languageInterpreted and compiled language
Interpreted and compiled language
baabtra.com - No. 1 supplier of quality freshers
 
Compilation of c
Compilation of cCompilation of c
Compilation of c
Way2itech
 
Functional programming ideas in python
Functional programming ideas in pythonFunctional programming ideas in python
Functional programming ideas in python
Manish Tomar
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
Md Hossen
 
Eclipse Luna - What's New!
Eclipse Luna - What's New!Eclipse Luna - What's New!
Eclipse Luna - What's New!
Noopur Gupta
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
sonalikharade3
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
Cihad Horuzoğlu
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
Hirdesh Vishwdewa
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
Akhil Kaushik
 
Language Translator ( Compiler)
Language Translator ( Compiler)Language Translator ( Compiler)
Language Translator ( Compiler)
Nazmul Hyder
 

What's hot (20)

compiler vs interpreter
compiler vs interpretercompiler vs interpreter
compiler vs interpreter
 
Computer programming project 15sec
Computer programming project 15secComputer programming project 15sec
Computer programming project 15sec
 
Language translator
Language translatorLanguage translator
Language translator
 
Compilation v. interpretation
Compilation v. interpretationCompilation v. interpretation
Compilation v. interpretation
 
TensorFlow Lite for mobile & IoT
TensorFlow Lite for mobile & IoT   TensorFlow Lite for mobile & IoT
TensorFlow Lite for mobile & IoT
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Introduction
IntroductionIntroduction
Introduction
 
Python Lecture 1
Python Lecture 1Python Lecture 1
Python Lecture 1
 
Introduction to compiler interpreter
Introduction to compiler interpreterIntroduction to compiler interpreter
Introduction to compiler interpreter
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
Interpreted and compiled language
Interpreted and compiled languageInterpreted and compiled language
Interpreted and compiled language
 
Compilation of c
Compilation of cCompilation of c
Compilation of c
 
Functional programming ideas in python
Functional programming ideas in pythonFunctional programming ideas in python
Functional programming ideas in python
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
Eclipse Luna - What's New!
Eclipse Luna - What's New!Eclipse Luna - What's New!
Eclipse Luna - What's New!
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Language Translator ( Compiler)
Language Translator ( Compiler)Language Translator ( Compiler)
Language Translator ( Compiler)
 

Viewers also liked

Datastructure algoritm
Datastructure algoritmDatastructure algoritm
Datastructure algoritm
Nergui Batjargal
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
Tareq Hasan
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
educationfront
 
Programming languages
Programming languagesProgramming languages
Programming languages
Asmasum
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 

Viewers also liked (6)

Datastructure algoritm
Datastructure algoritmDatastructure algoritm
Datastructure algoritm
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 

Similar to Algorithm and Programming

Dive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdfDive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdf
SudhanshiBakre1
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
Ruth Marvin
 
Reasons to migrate from Delphi 7 to Delphi 2009
Reasons to migrate from Delphi 7  to Delphi 2009Reasons to migrate from Delphi 7  to Delphi 2009
Reasons to migrate from Delphi 7 to Delphi 2009
Michael Findling
 
Reasons to migrate from Delphi 7 to Delphi 2009
Reasons to migrate from Delphi 7 to Delphi 2009Reasons to migrate from Delphi 7 to Delphi 2009
Reasons to migrate from Delphi 7 to Delphi 2009
Michael Findling
 
Javascript mynotes
Javascript mynotesJavascript mynotes
Javascript mynotes
AntoniaSymeonidou1
 
Ex11 mini project
Ex11 mini projectEx11 mini project
Ex11 mini project
Elanthendral Mariappan
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
muniryaseen
 
Top Ten Reasons to Upgrade from Delphi 7
Top Ten Reasons to Upgrade from Delphi 7Top Ten Reasons to Upgrade from Delphi 7
Top Ten Reasons to Upgrade from Delphi 7
Michael Findling
 
Envisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesEnvisioning the Future of Language Workbenches
Envisioning the Future of Language Workbenches
Markus Voelter
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
Riccardo Terrell
 
C++ question and answers
C++ question and answersC++ question and answers
C++ question and answers
AdenKheire
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
Martin Chapman
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
Tomas Petricek
 
Compose Camp session 2.pptx.pdf
Compose Camp session 2.pptx.pdfCompose Camp session 2.pptx.pdf
Compose Camp session 2.pptx.pdf
Dhruv675089
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
RohitKumar639388
 
Agile development with Ruby
Agile development with RubyAgile development with Ruby
Agile development with Ruby
khelll
 
Book management system
Book management systemBook management system
Book management system
SHARDA SHARAN
 
Python training
Python trainingPython training
Python training
Kunalchauhan76
 
Tell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature FlagsTell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature Flags
Jorge Ortiz
 
Cs121 Unit Test
Cs121 Unit TestCs121 Unit Test
Cs121 Unit Test
Jill Bell
 

Similar to Algorithm and Programming (20)

Dive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdfDive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdf
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
 
Reasons to migrate from Delphi 7 to Delphi 2009
Reasons to migrate from Delphi 7  to Delphi 2009Reasons to migrate from Delphi 7  to Delphi 2009
Reasons to migrate from Delphi 7 to Delphi 2009
 
Reasons to migrate from Delphi 7 to Delphi 2009
Reasons to migrate from Delphi 7 to Delphi 2009Reasons to migrate from Delphi 7 to Delphi 2009
Reasons to migrate from Delphi 7 to Delphi 2009
 
Javascript mynotes
Javascript mynotesJavascript mynotes
Javascript mynotes
 
Ex11 mini project
Ex11 mini projectEx11 mini project
Ex11 mini project
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Top Ten Reasons to Upgrade from Delphi 7
Top Ten Reasons to Upgrade from Delphi 7Top Ten Reasons to Upgrade from Delphi 7
Top Ten Reasons to Upgrade from Delphi 7
 
Envisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesEnvisioning the Future of Language Workbenches
Envisioning the Future of Language Workbenches
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
 
C++ question and answers
C++ question and answersC++ question and answers
C++ question and answers
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
 
Compose Camp session 2.pptx.pdf
Compose Camp session 2.pptx.pdfCompose Camp session 2.pptx.pdf
Compose Camp session 2.pptx.pdf
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
 
Agile development with Ruby
Agile development with RubyAgile development with Ruby
Agile development with Ruby
 
Book management system
Book management systemBook management system
Book management system
 
Python training
Python trainingPython training
Python training
 
Tell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature FlagsTell Me Quando - Implementing Feature Flags
Tell Me Quando - Implementing Feature Flags
 
Cs121 Unit Test
Cs121 Unit TestCs121 Unit Test
Cs121 Unit Test
 

Recently uploaded

How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
Celine George
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
Celine George
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
OH TEIK BIN
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
ImMuslim
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
Nguyen Thanh Tu Collection
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Kalna College
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
IsmaelVazquez38
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
 

Recently uploaded (20)

How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
 

Algorithm and Programming

  • 2. Recall from previous session  Function: also known as method/procedure which is a set of commands that can be called again and over again.  Benefits of Function?  Define Function then Call the Function to Execute  Define one function inside another function  Function is a form of Abstraction finding one solution for multiple problems.  Function use Top Down approach breaking down big problems to sub problems.
  • 3. LESSON OBJECTIVES Students will:  Learn to read App Lab’s API documentation  Use functions that accept parameters in order to complete a series of drawing puzzles  Design a personal monogram making use of the commands you learned during the lesson  Activity: Demonstrate your knowledge in Practice L7: API & Functions with Parameter
  • 4. Discussion Board on D2L  What makes a Programmer? 1. Reading Documentation 2. Learn by seeing examples of a language 3. Professional programmers will frequently reference documentation while designing software 4. Learning habits of mind and patterns that allow you to use a language (including its documentation) effectively 5. Practice makes you a perfect programmer
  • 5. L7: API & Functions with Parameter  API (Application Programming Interface) is a collection of commands used to build applications.  Functions have parameters which are information that customize and control the behavior of a function.  For example, you can specify moveForward(103) to move the turtle exactly 103 pixels  Library collection of functions with shared purpose.  Documentation: A description of the behavior of a function  Since parameter value can change, you will often see a written description for the command. Example: moveForward(distance), turnLeft(angle) - drawRectangle(sideLength, width).Code.org Code.org
  • 6. L7: API & Functions with Parameter  App Lab has documentation: look up documentation about the commands of the language penColor(), penWidth() dot(), arcLeft(), arcRight(), moveTo(), turnTo() Hexadecimal penColor(“#FF0099”) Students are asked read documentation about all the new commands. Watch Video
  • 7. L7: Activity 1 to 13 on Code.org  Design a personal monogram making use of the commands you learned during the lesson  Share your image & Upload to D2L Draw whatever you like! The only requirements are: • use at least 3 different colors • use moveTo Explore the documentation for any new commands you see and use your skills as both an artist and user of API documentation to draw something of your own choosing. If in doubt: try to re-create "I [heart] CS" drawing shown here.
  • 8. Learning Objectives  Identify situations for creating functions with parameters.  Incorporate functions with parameters into an "Under the Sea" digital scene.  Test functions with parameters using random input. L8: Creating Functions with Parameters Watch Video
  • 9. L8: Creating Functions with Parameters  What are the benefits of creating Functions with Parameters? 1. Control behavior of the function – Customize it for user needs. 2. Create complex drawings. 3. Can generalize solutions to problems instead of duplicating code. 4. Offers extra flexibility - removes the need to create multiple functions that do almost the same thing. – Remove repetition and patterns 5. Easily experiment with different inputs to see what kind of output we can produce. Watch Video D2L Discuss & Share
  • 10.  Defining multiple functions to draw different sized squares results in lots of repetitive functions .  Any time you find yourself effectively copy and pasting large sections of code, it's usually a sign that there is a better way. L8: Creating Functions with Parameters
  • 11. L8 Activity 1 to 14 on Code.org  Modify the program that creates an “Under the Sea” scene by adding parameters to functions.  Use the random number functions to supply random values to function calls so the scene looks a little different every time the program runs. Example: randomNumber(0,3) to randomize image so that every time your run program you get different scenes like below:
  • 12. Recap from this session  What is an API  How to create a function with parameter  How to become a good programmer  Benefit of creating functions with parameters