SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Python with AI – I
Session 4
Logistics
• Please paste your repl link for this session in the google sheet
• Be prepared to share your screen
• A repl link with questions to all exercises we will do today in the
class will be provided
Course Curriculum
Session
Number
What is covered
1 Python basics – conditionals and loops
2 Python packages – pandas dataframes
3 Data structures in python – lists, arrays, dictionaries
4 Create and manipulate datasets in python
5 REST API and Github
6 Connecting two or more AIs in an Application
7 Data Visualization
8 Final Projects
Operators in python - Recap
Operator Syntax Description
Sum + Adds two numbers (or) strings
Subtraction - Only numbers
Product * Product of numbers, repetition of strings
Division / Division between numbers
Modulo % Remainder of division between two
numbers
Power ** Power of one number over another
Conditionals - Recap
• The if statement
Conditional Description
== Equal
!= Not Equal
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
Loops - Recap
• The for loop is of the following form.
• The range indicates the number of times a statement will be
implemented.
• There is a colon value to indicate the start of for loop.
• The code below is executed many times. The number of times it gets
executed depends on the values specified in range.
• Note that the code below the for statement is indented.
Lists- Recap
• A list holds ordered collection of items.
• And item can be a string or a number
Dictionaries - Recap
• A dictionary consists of two things (a) keys (b) values
• Use strings to represent keys
• Values can be anything
Dictionaries - Recap
• Print a value in a dictionary
• Delete a value in a dictionary
• Print all keys of a dictionary
• Add values to a dictionary
Functions in python
• Re-usable pieces of code
Functions accept parameters
• How would you call this function?
Call a function that accepts parameters
• How would you call this function?
Functions return values
• How would you call this function?
How would you call this function
• How would you call this function?
Functions can accept and return multiple
values
• How would you call this function?
Functions can accept and return multiple
values
• How would you call this function?
Exercise
Modules in python
• Use multiple functions written by others
Modules in python
• Use multiple functions written by others
• Popular packages: numpy, pandas
• How do you tell python to use these packages?
Modules in python
• Use multiple functions written by others
• Popular packages: numpy, pandas
• How do you tell python to use these packages?
Numpy package - arrays
• Example of an array
Numpy package - arrays
• Example of a 2D array
Can all lists be converted to numpy arrays?
Why should I use a numpy array?
• Arrays are more convenient – How?
Create random numbers
Create random numbers
• Generate random integers
• Generate random numbers
http://aiclub.world

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (18)

Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1
 
Lisp
LispLisp
Lisp
 
Scheme Programming Language
Scheme Programming LanguageScheme Programming Language
Scheme Programming Language
 
Pa2 session 4
Pa2 session 4Pa2 session 4
Pa2 session 4
 
Basic lisp
Basic lispBasic lisp
Basic lisp
 
Scheme language
Scheme languageScheme language
Scheme language
 
Lisp
LispLisp
Lisp
 
Introduction to Programming in LISP
Introduction to Programming in LISPIntroduction to Programming in LISP
Introduction to Programming in LISP
 
Part 2 Python
Part 2 PythonPart 2 Python
Part 2 Python
 
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming Languge
 
Why fp
Why fpWhy fp
Why fp
 
Intro to programing with java-lecture 3
Intro to programing with java-lecture 3Intro to programing with java-lecture 3
Intro to programing with java-lecture 3
 
Basics of Functional Programming
Basics of Functional ProgrammingBasics of Functional Programming
Basics of Functional Programming
 
Array 2011
Array 2011Array 2011
Array 2011
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 

Ähnlich wie Pa1 session 4_slides

ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdflailoesakhan
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxRohitKumar639388
 
PA I Session I Recap
PA I Session I RecapPA I Session I Recap
PA I Session I Recapaiclub_slides
 
Python indroduction
Python indroductionPython indroduction
Python indroductionFEG
 
What's new in pandas and the SciPy stack for financial users
What's new in pandas and the SciPy stack for financial usersWhat's new in pandas and the SciPy stack for financial users
What's new in pandas and the SciPy stack for financial usersWes McKinney
 
Functions
FunctionsFunctions
FunctionsOnline
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshopamptiny
 
Functions in c
Functions in cFunctions in c
Functions in creshmy12
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Fwdays
 
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.pdfSudhanshiBakre1
 
Programming with Python - Week 3
Programming with Python - Week 3Programming with Python - Week 3
Programming with Python - Week 3Ahmet Bulut
 

Ähnlich wie Pa1 session 4_slides (20)

Python
PythonPython
Python
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
 
Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
 
PA I Session I Recap
PA I Session I RecapPA I Session I Recap
PA I Session I Recap
 
Python indroduction
Python indroductionPython indroduction
Python indroduction
 
Python training
Python trainingPython training
Python training
 
What's new in pandas and the SciPy stack for financial users
What's new in pandas and the SciPy stack for financial usersWhat's new in pandas and the SciPy stack for financial users
What's new in pandas and the SciPy stack for financial users
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Functions
FunctionsFunctions
Functions
 
Python_basics.pptx
Python_basics.pptxPython_basics.pptx
Python_basics.pptx
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
Functions-.pdf
Functions-.pdfFunctions-.pdf
Functions-.pdf
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshop
 
Functions
FunctionsFunctions
Functions
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
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
 
Programming with Python - Week 3
Programming with Python - Week 3Programming with Python - Week 3
Programming with Python - Week 3
 

Mehr von aiclub_slides

Linear regression middleschool
Linear regression middleschoolLinear regression middleschool
Linear regression middleschoolaiclub_slides
 
Pa2 project template
Pa2 project templatePa2 project template
Pa2 project templateaiclub_slides
 
Knn intro advanced_middleschool
Knn intro advanced_middleschoolKnn intro advanced_middleschool
Knn intro advanced_middleschoolaiclub_slides
 
M1 regression metrics_middleschool
M1 regression metrics_middleschoolM1 regression metrics_middleschool
M1 regression metrics_middleschoolaiclub_slides
 
Ai in real life face detection
Ai in real life   face detectionAi in real life   face detection
Ai in real life face detectionaiclub_slides
 
Res net high level intro
Res net high level introRes net high level intro
Res net high level introaiclub_slides
 
Neural networks and flattened images
Neural networks and flattened imagesNeural networks and flattened images
Neural networks and flattened imagesaiclub_slides
 
What is a_neural_network
What is a_neural_networkWhat is a_neural_network
What is a_neural_networkaiclub_slides
 
How neural networks learn part iii
How neural networks learn part iiiHow neural networks learn part iii
How neural networks learn part iiiaiclub_slides
 
Introduction to deep learning image classification
Introduction to deep learning   image classificationIntroduction to deep learning   image classification
Introduction to deep learning image classificationaiclub_slides
 
Accuracy middleschool
Accuracy middleschoolAccuracy middleschool
Accuracy middleschoolaiclub_slides
 
Introduction to classification_middleschool
Introduction to classification_middleschoolIntroduction to classification_middleschool
Introduction to classification_middleschoolaiclub_slides
 
Introduction to the cloud
Introduction to the cloudIntroduction to the cloud
Introduction to the cloudaiclub_slides
 
Ai lifecycle and navigator
Ai lifecycle and navigatorAi lifecycle and navigator
Ai lifecycle and navigatoraiclub_slides
 

Mehr von 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
 

Kürzlich hochgeladen

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Kürzlich hochgeladen (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Pa1 session 4_slides

  • 1. Python with AI – I Session 4
  • 2. Logistics • Please paste your repl link for this session in the google sheet • Be prepared to share your screen • A repl link with questions to all exercises we will do today in the class will be provided
  • 3. Course Curriculum Session Number What is covered 1 Python basics – conditionals and loops 2 Python packages – pandas dataframes 3 Data structures in python – lists, arrays, dictionaries 4 Create and manipulate datasets in python 5 REST API and Github 6 Connecting two or more AIs in an Application 7 Data Visualization 8 Final Projects
  • 4. Operators in python - Recap Operator Syntax Description Sum + Adds two numbers (or) strings Subtraction - Only numbers Product * Product of numbers, repetition of strings Division / Division between numbers Modulo % Remainder of division between two numbers Power ** Power of one number over another
  • 5. Conditionals - Recap • The if statement Conditional Description == Equal != Not Equal > Greater than < Less than >= Greater than or equal to <= Less than or equal to
  • 6. Loops - Recap • The for loop is of the following form. • The range indicates the number of times a statement will be implemented. • There is a colon value to indicate the start of for loop. • The code below is executed many times. The number of times it gets executed depends on the values specified in range. • Note that the code below the for statement is indented.
  • 7. Lists- Recap • A list holds ordered collection of items. • And item can be a string or a number
  • 8. Dictionaries - Recap • A dictionary consists of two things (a) keys (b) values • Use strings to represent keys • Values can be anything
  • 9. Dictionaries - Recap • Print a value in a dictionary • Delete a value in a dictionary • Print all keys of a dictionary • Add values to a dictionary
  • 10. Functions in python • Re-usable pieces of code
  • 11. Functions accept parameters • How would you call this function?
  • 12. Call a function that accepts parameters • How would you call this function?
  • 13. Functions return values • How would you call this function?
  • 14. How would you call this function • How would you call this function?
  • 15. Functions can accept and return multiple values • How would you call this function?
  • 16. Functions can accept and return multiple values • How would you call this function?
  • 18. Modules in python • Use multiple functions written by others
  • 19. Modules in python • Use multiple functions written by others • Popular packages: numpy, pandas • How do you tell python to use these packages?
  • 20. Modules in python • Use multiple functions written by others • Popular packages: numpy, pandas • How do you tell python to use these packages?
  • 21. Numpy package - arrays • Example of an array
  • 22. Numpy package - arrays • Example of a 2D array
  • 23. Can all lists be converted to numpy arrays?
  • 24. Why should I use a numpy array? • Arrays are more convenient – How?
  • 26. Create random numbers • Generate random integers • Generate random numbers