SlideShare a Scribd company logo
Python with AI – I
Flow Chart
What are flow charts
• A flow chart represents the algorithm using a diagram
• Creating a flow chart helps design the logic of the program
Example – Add two numbers given by a user
Example – Add two numbers given by a user
Start
Accept first
input: num1
Example – Add two numbers given by a user
Start
Accept first
input: num1
Accept second
input: num2
Example – Add two numbers given by a user
Start
Accept first
input: num1
Accept second
input: num2
Sum = num1 + num2
Example – Add two numbers given by a user
Start
Accept first
input: num1
Accept second
input: num2
Add = num1 + num2
Print Add
Stop
Example – Add two numbers given by a user
Start
Accept first
input: num1
Accept first
input: num2
Add = num1 + num2
Print Add
Stop
Example – Add two numbers given by a user
Start
Accept first
input: num1
Accept first
input: num2
Add = num1 + num2
Print Add
Stop
Basic flow chart symbols
Symbol Purpose Description
Flow line Indicated the flow from one block
to another
Start/Stop Represents the start and end of the
flow chart
Processing Arithmetic operations
Input/Output Input and output operations
Conditional Decision making block
Example – Print the maximum between two
numbers Start
Accept first
number: num1
Accept second
number: num2
as input
Print num1
Stop
If
num1>
num2
Print num2
True False
Example – Print the maximum between two
numbers Start
Accept first
number: num1
Accept second
number: num2
as input
Print num1
Stop
If
num1>
num2
Print num2
True False
Verify that the flow chart
works correctly for a few
examples
num1 = 10, num2 = 20
num1 = 15, num2 = 5
Exercise: Create a flow chart for this problem
• Given 3 numbers, a, b, c, find the maximum value
Exercise: Create a flow chart for this problem
• Given 3 numbers, a, b, c, find the maximum value
• Verify that what your flow chart works correctly
• Examples:
• a = 10, b = 20, c = 30
• a = 15, b = 30, c = 5
• a = 40, b =80, c = 120
Exercise: Create code
Start
Declare 3
numbers: a, b, c
If a > b
Print b
FalseTrue
If a > c
Print a
If b > cPrint c
Stop
True True
False False
Loops in flow chart
• Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
Loops in flow chart
Start
Declare list_sample [4, 3, 2, 5, 8]
Declare a variable len_list that stored the length of the list
Loops in flow chart
Start
Declare list_sample [4, 3, 2, 5, 8]
Declare a variable len_list that stored the length of the list
Loops in flow chart
Start
Declare list_sample [4, 3, 2, 5, 8]
Declare a number a=0
Declare a variable len_list that stores the length of the list
If a >
len_list
Stop a = a+1
value =
list_sample[a]
If value is
a even
number
Print value
True False
False True
Loops in flow chart
• Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
Loops in flow chart - while
• Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
Loops in flow chart - while
• Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
Declare a number a=0
If a >
len_list
Stop a = a+1
value =
list_sample[a]
If value is
a even
number
Print value
True False
False True
Exercise: Design a chat bot - flowchart
• list_happy_words = [“joyful”, “happy”, “amazing”, “beautiful”]
• list_sad_words = [“sad”, “tears”, “crying”, “depressed”]
• list_games = [“tetris”, “flappy bird”, “snake”]
• Ask the user to enter a word that describes their feeling
• If the feeling they enter is one of the list_happy_words, print “Glad you are
happy” and exit.
• If the feeling they enter is one of the list_sad_words, ask the user to play
one of the games from the list list_games.
• Ask the user again how they are feeling and continue till the list of games is
exhausted.
• If you already suggested all the games and the user is still unhappy, exit.
Exercise: Design a chat bot - code
Start
Declare the 3 lists
Ask the user to input a word describing their feeling, save the string
Check if
word is a
part of
happy list
Check if
word is a
part of
sad list
True
Stop
Print
sentence
False
False True
Print
sentence
Print
game
Exercise: Design a chat bot - code
Start
Declare the 3 lists
Ask the user to input a word describing their feeling, save the string
Check if
word is a
part of
happy list
Check if
word is a
part of
sad list
True
Stop
Print
sentence
False
False True
Print
sentence
Print
game
Check if
your
games
list is
over
False
Lets try it!
http://aiclub.world

More Related Content

What's hot

Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
Appili Vamsi Krishna
 
computer notes - Data Structures - 37
computer notes - Data Structures - 37computer notes - Data Structures - 37
computer notes - Data Structures - 37ecomputernotes
 
Pure Laziness: An Exploration of Haskell
Pure Laziness: An Exploration of HaskellPure Laziness: An Exploration of Haskell
Pure Laziness: An Exploration of Haskell
Mitchell Vitez
 
Lecture 6 - Arrays
Lecture 6 - ArraysLecture 6 - Arrays
Lecture 6 - Arrays
Syed Afaq Shah MACS CP
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
Maulen Bale
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
Janpreet Singh
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
janani thirupathi
 
Numpy python cheat_sheet
Numpy python cheat_sheetNumpy python cheat_sheet
Numpy python cheat_sheet
Nishant Upadhyay
 
Making a frequency chart
Making a frequency chartMaking a frequency chart
Making a frequency chart
jwarnerx0x
 
02 Arrays And Memory Mapping
02 Arrays And Memory Mapping02 Arrays And Memory Mapping
02 Arrays And Memory MappingQundeel
 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
Education Front
 
Array
ArrayArray
Arrays
ArraysArrays
Learn Java Part 9
Learn Java Part 9Learn Java Part 9
Learn Java Part 9
Gurpreet singh
 
Array data structure
Array data structureArray data structure
Array data structure
maamir farooq
 
One dimensional 2
One dimensional 2One dimensional 2
One dimensional 2
Rajendran
 

What's hot (20)

Sorting
SortingSorting
Sorting
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
 
computer notes - Data Structures - 37
computer notes - Data Structures - 37computer notes - Data Structures - 37
computer notes - Data Structures - 37
 
Pure Laziness: An Exploration of Haskell
Pure Laziness: An Exploration of HaskellPure Laziness: An Exploration of Haskell
Pure Laziness: An Exploration of Haskell
 
Lecture 6 - Arrays
Lecture 6 - ArraysLecture 6 - Arrays
Lecture 6 - Arrays
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
 
2-D array
2-D array2-D array
2-D array
 
03 control
03 control03 control
03 control
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Numpy python cheat_sheet
Numpy python cheat_sheetNumpy python cheat_sheet
Numpy python cheat_sheet
 
Making a frequency chart
Making a frequency chartMaking a frequency chart
Making a frequency chart
 
02 Arrays And Memory Mapping
02 Arrays And Memory Mapping02 Arrays And Memory Mapping
02 Arrays And Memory Mapping
 
2- Dimensional Arrays
2- Dimensional Arrays2- Dimensional Arrays
2- Dimensional Arrays
 
Array
ArrayArray
Array
 
Arrays
ArraysArrays
Arrays
 
Learn Java Part 9
Learn Java Part 9Learn Java Part 9
Learn Java Part 9
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Array data structure
Array data structureArray data structure
Array data structure
 
One dimensional 2
One dimensional 2One dimensional 2
One dimensional 2
 

Similar to Pa1 flow chart

Pa1 flow chart
Pa1 flow chartPa1 flow chart
Pa1 flow chart
aiclub_slides
 
Pa1 lists subset
Pa1 lists subsetPa1 lists subset
Pa1 lists subset
aiclub_slides
 
Pa1 wednesday flow_chart
Pa1 wednesday flow_chartPa1 wednesday flow_chart
Pa1 wednesday flow_chart
aiclub_slides
 
PA1 lists
PA1 listsPA1 lists
PA1 lists
aiclub_slides
 
Pythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptxPythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptx
MihirDatir
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
Elsayed Hemayed
 
paython practical
paython practical paython practical
paython practical
Upadhyayjanki
 
Pythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptxPythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptx
MihirDatir1
 
Lists and loops
Lists and loopsLists and loops
Lists and loops
aiclub_slides
 
Lists.pptx
Lists.pptxLists.pptx
Lists.pptx
Yagna15
 
Python basics
Python basicsPython basics
Python basics
Hoang Nguyen
 
Python basics
Python basicsPython basics
Python basics
Fraboni Ec
 
Python basics
Python basicsPython basics
Python basics
James Wong
 
Python basics
Python basicsPython basics
Python basics
Tony Nguyen
 
Python-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptxPython-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptx
ElijahSantos4
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
SONU KUMAR
 
Strings.pptx
Strings.pptxStrings.pptx
Strings.pptx
Yagna15
 

Similar to Pa1 flow chart (20)

Pa1 flow chart
Pa1 flow chartPa1 flow chart
Pa1 flow chart
 
Pa1 lists subset
Pa1 lists subsetPa1 lists subset
Pa1 lists subset
 
Pa1 wednesday flow_chart
Pa1 wednesday flow_chartPa1 wednesday flow_chart
Pa1 wednesday flow_chart
 
PA1 lists
PA1 listsPA1 lists
PA1 lists
 
Pythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptxPythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptx
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
 
paython practical
paython practical paython practical
paython practical
 
Pythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptxPythonlearn-08-Lists.pptx
Pythonlearn-08-Lists.pptx
 
Lists and loops
Lists and loopsLists and loops
Lists and loops
 
Lists.pptx
Lists.pptxLists.pptx
Lists.pptx
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptxPython-CH01L04-Presentation.pptx
Python-CH01L04-Presentation.pptx
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
 
Strings.pptx
Strings.pptxStrings.pptx
Strings.pptx
 

More from aiclub_slides

Linear regression middleschool
Linear regression middleschoolLinear regression middleschool
Linear regression middleschool
aiclub_slides
 
Pa2 project template
Pa2 project templatePa2 project template
Pa2 project template
aiclub_slides
 
Knn intro advanced_middleschool
Knn intro advanced_middleschoolKnn intro advanced_middleschool
Knn intro advanced_middleschool
aiclub_slides
 
M1 regression metrics_middleschool
M1 regression metrics_middleschoolM1 regression metrics_middleschool
M1 regression metrics_middleschool
aiclub_slides
 
Pa1 json requests
Pa1 json requestsPa1 json requests
Pa1 json requests
aiclub_slides
 
Mnist images
Mnist imagesMnist images
Mnist images
aiclub_slides
 
Mnist images
Mnist imagesMnist images
Mnist images
aiclub_slides
 
Ai in real life face detection
Ai in real life   face detectionAi in real life   face detection
Ai in real life face detection
aiclub_slides
 
Res net high level intro
Res net high level introRes net high level intro
Res net high level intro
aiclub_slides
 
Neural networks and flattened images
Neural networks and flattened imagesNeural networks and flattened images
Neural networks and flattened images
aiclub_slides
 
What is a_neural_network
What is a_neural_networkWhat is a_neural_network
What is a_neural_network
aiclub_slides
 
How neural networks learn part iii
How neural networks learn part iiiHow neural networks learn part iii
How neural networks learn part iii
aiclub_slides
 
Introduction to deep learning image classification
Introduction to deep learning   image classificationIntroduction to deep learning   image classification
Introduction to deep learning image classification
aiclub_slides
 
Accuracy middleschool
Accuracy middleschoolAccuracy middleschool
Accuracy middleschool
aiclub_slides
 
Introduction to classification_middleschool
Introduction to classification_middleschoolIntroduction to classification_middleschool
Introduction to classification_middleschool
aiclub_slides
 
Introduction to the cloud
Introduction to the cloudIntroduction to the cloud
Introduction to the cloud
aiclub_slides
 
Basics of data
Basics of dataBasics of data
Basics of data
aiclub_slides
 
Ai basics
Ai basicsAi basics
Ai basics
aiclub_slides
 
Ai lifecycle and navigator
Ai lifecycle and navigatorAi lifecycle and navigator
Ai lifecycle and navigator
aiclub_slides
 

More from aiclub_slides (20)

Linear regression middleschool
Linear regression middleschoolLinear regression middleschool
Linear regression middleschool
 
Pa2 project template
Pa2 project templatePa2 project template
Pa2 project template
 
Knn intro advanced_middleschool
Knn intro advanced_middleschoolKnn intro advanced_middleschool
Knn intro advanced_middleschool
 
M1 regression metrics_middleschool
M1 regression metrics_middleschoolM1 regression metrics_middleschool
M1 regression metrics_middleschool
 
Pa1 json requests
Pa1 json requestsPa1 json requests
Pa1 json requests
 
Mnist images
Mnist imagesMnist images
Mnist images
 
Mnist images
Mnist imagesMnist images
Mnist images
 
Ai in real life face detection
Ai in real life   face detectionAi in real life   face detection
Ai in real life face detection
 
Cnn
CnnCnn
Cnn
 
Res net high level intro
Res net high level introRes net high level intro
Res net high level intro
 
Neural networks and flattened images
Neural networks and flattened imagesNeural networks and flattened images
Neural networks and flattened images
 
What is a_neural_network
What is a_neural_networkWhat is a_neural_network
What is a_neural_network
 
How neural networks learn part iii
How neural networks learn part iiiHow neural networks learn part iii
How neural networks learn part iii
 
Introduction to deep learning image classification
Introduction to deep learning   image classificationIntroduction to deep learning   image classification
Introduction to deep learning image classification
 
Accuracy middleschool
Accuracy middleschoolAccuracy middleschool
Accuracy middleschool
 
Introduction to classification_middleschool
Introduction to classification_middleschoolIntroduction to classification_middleschool
Introduction to classification_middleschool
 
Introduction to the cloud
Introduction to the cloudIntroduction to the cloud
Introduction to the cloud
 
Basics of data
Basics of dataBasics of data
Basics of data
 
Ai basics
Ai basicsAi basics
Ai basics
 
Ai lifecycle and navigator
Ai lifecycle and navigatorAi lifecycle and navigator
Ai lifecycle and navigator
 

Recently uploaded

678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 

Pa1 flow chart

  • 1. Python with AI – I Flow Chart
  • 2. What are flow charts • A flow chart represents the algorithm using a diagram • Creating a flow chart helps design the logic of the program
  • 3. Example – Add two numbers given by a user
  • 4. Example – Add two numbers given by a user Start Accept first input: num1
  • 5. Example – Add two numbers given by a user Start Accept first input: num1 Accept second input: num2
  • 6. Example – Add two numbers given by a user Start Accept first input: num1 Accept second input: num2 Sum = num1 + num2
  • 7. Example – Add two numbers given by a user Start Accept first input: num1 Accept second input: num2 Add = num1 + num2 Print Add Stop
  • 8. Example – Add two numbers given by a user Start Accept first input: num1 Accept first input: num2 Add = num1 + num2 Print Add Stop
  • 9. Example – Add two numbers given by a user Start Accept first input: num1 Accept first input: num2 Add = num1 + num2 Print Add Stop
  • 10. Basic flow chart symbols Symbol Purpose Description Flow line Indicated the flow from one block to another Start/Stop Represents the start and end of the flow chart Processing Arithmetic operations Input/Output Input and output operations Conditional Decision making block
  • 11. Example – Print the maximum between two numbers Start Accept first number: num1 Accept second number: num2 as input Print num1 Stop If num1> num2 Print num2 True False
  • 12. Example – Print the maximum between two numbers Start Accept first number: num1 Accept second number: num2 as input Print num1 Stop If num1> num2 Print num2 True False Verify that the flow chart works correctly for a few examples num1 = 10, num2 = 20 num1 = 15, num2 = 5
  • 13. Exercise: Create a flow chart for this problem • Given 3 numbers, a, b, c, find the maximum value
  • 14. Exercise: Create a flow chart for this problem • Given 3 numbers, a, b, c, find the maximum value • Verify that what your flow chart works correctly • Examples: • a = 10, b = 20, c = 30 • a = 15, b = 30, c = 5 • a = 40, b =80, c = 120
  • 15. Exercise: Create code Start Declare 3 numbers: a, b, c If a > b Print b FalseTrue If a > c Print a If b > cPrint c Stop True True False False
  • 16. Loops in flow chart • Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
  • 17. Loops in flow chart Start Declare list_sample [4, 3, 2, 5, 8] Declare a variable len_list that stored the length of the list
  • 18. Loops in flow chart Start Declare list_sample [4, 3, 2, 5, 8] Declare a variable len_list that stored the length of the list
  • 19. Loops in flow chart Start Declare list_sample [4, 3, 2, 5, 8] Declare a number a=0 Declare a variable len_list that stores the length of the list If a > len_list Stop a = a+1 value = list_sample[a] If value is a even number Print value True False False True
  • 20. Loops in flow chart • Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
  • 21. Loops in flow chart - while • Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers
  • 22. Loops in flow chart - while • Given a list list_sample = [4, 3, 2, 5, 8], print all the even numbers Declare a number a=0 If a > len_list Stop a = a+1 value = list_sample[a] If value is a even number Print value True False False True
  • 23. Exercise: Design a chat bot - flowchart • list_happy_words = [“joyful”, “happy”, “amazing”, “beautiful”] • list_sad_words = [“sad”, “tears”, “crying”, “depressed”] • list_games = [“tetris”, “flappy bird”, “snake”] • Ask the user to enter a word that describes their feeling • If the feeling they enter is one of the list_happy_words, print “Glad you are happy” and exit. • If the feeling they enter is one of the list_sad_words, ask the user to play one of the games from the list list_games. • Ask the user again how they are feeling and continue till the list of games is exhausted. • If you already suggested all the games and the user is still unhappy, exit.
  • 24. Exercise: Design a chat bot - code Start Declare the 3 lists Ask the user to input a word describing their feeling, save the string Check if word is a part of happy list Check if word is a part of sad list True Stop Print sentence False False True Print sentence Print game
  • 25. Exercise: Design a chat bot - code Start Declare the 3 lists Ask the user to input a word describing their feeling, save the string Check if word is a part of happy list Check if word is a part of sad list True Stop Print sentence False False True Print sentence Print game Check if your games list is over False