SlideShare uma empresa Scribd logo
1 de 32
CS114 - Fundamental of Programming
Lecture 1: Introduction
Dr. Nazia Perwaiz
vision.seecs.edu.pk
Content
• Why programming for ChE Students?
• Why Python?
• Course Outline
• Setting up Google Collab
• Printing
• Arithmetic with Python
• Variables and variable typing
2
Why Programming course?
3
Why Programming for ChE Students?
4
Why Programming for ChE Students?
5
Why Programming for ChE Students?
6
Why Programming for ChE Students?
7
Why Programming for ChE Students?
8
9
10
https://jckantor.github.io/ND-Pyomo-Cookbook/notebooks/05.02-Exothermic-CSTR.html
11
Python library ChemPlot for clustering the chemical space and selecting specific clusters
https://chemistry-europe.onlinelibrary.wiley.com/doi/10.1002/cmtd.202200005
12
Produced Water Chemistry and Isotope Analysis with Python and Pandas
https://hatarilabs.com/ih-en/produced-water-chemistry-and-isotope-analysis-with-python-and-pandas-tutorial
13
Taking the leap between analytical chemistry and artificial intelligence
https://www.sciencedirect.com/science/article/abs/pii/S0003267021002294#undfig1
Python for Chemical Engineering Applications
Python used for chemical engineering tasks:
1. Process simulation: Pyomo is a Python library for modeling and
solving mathematical optimization problems. It can be used to model
and optimize chemical processes, such as distillation columns and
reactors.
2. Data analysis: Pandas is a popular Python library for data analysis.
It can be used to manipulate and analyze large sets of data, such as
process data from sensors or experiments.
14
Python for Chemical Engineering Applications
3. Visualization: Matplotlib is a Python library for creating visualizations.
It can be used to create plots and charts of process variables, such
as temperature and flow rate, to aid in understanding and analyzing
data.
4. Kinetic model: Cantera is a Python library that can be used to create
and simulate kinetic models of chemical reactions. It can be used to
model combustion reactions, atmospheric chemistry and more.
5. Equation solving: Scipy has an optimize module that can be used to
solve equations, it can be used to solve systems of non-linear
equations, which is a common task in chemical engineering.
15
No Worries…
16
Course Objectives
17
• Developing comprehensive knowledge about the
fundamental principles, concepts and constructs of
modern computer programming.
• Developing competencies for the design, coding and
debugging of computer programs.
Course Learning Outcomes
18
• To understand the syntax and semantics of different
programming constructs
• To understand basic algorithms for identifying and solving
real-world problems
• To develop computer programs to implement these
algorithms
• To use the latest IDEs and other supplementary tools to aid
implementation and code management
Grading Breakdown
19
Theory - 75%
• 30% Mid
• 10% Quizzes
• 10% Assignments
• 50% Final Exam
Labs - 25 %
• 70% Lab Tasks
• 30% Project
Books
20
Text Book: 1. Python Basics: A Practical Introduction to Python 3, 4th Edition, David
Amos, Fletcher Heisler, and Joanna Jablonski
Reference
Books:
1. A Practical Introduction to Python Programming, Brian Heinold
2. Introduction to Computation and Programming Using Python, John V.
Guttag, The MIT Press
3. Practical Programming, An Introduction to Computer Science Using
Python 3, 2nd Edition, Paul Gries, Jennifer Campbell, Jason Montojo
Lesson Plan
21
Week Lecture Topic (Tentative)
01 Introduction, Programming Fundamentals, Introduction to Python
02 Variables, expressions, and data types
03 Operators (Arithmetic & Logical)
04 Algorithms, pseudo code, and flow charts
05 Decision making
06 Loops
07 Loops
08 Functions
09 Mid Semester Exam
10 Functions
11 Arrays
12 Strings
13 Lists
14 Searching, sorting
15 Lists’ applications
16 Creating graphical user interfaces (GUI)
17 Project Demos/ Presentations
18 End Semester Exam
Hardware
vs
Software
???
22
23
Algorithm
vs
Psudocode
???
24
High-level Language
vs
Low-level Language
???
25
Syntax
vs
Semantics
???
High-level Language: Designed to be used and understood by humans
Low-level Language: Computer hardware can only understand a very low level
language known as machine language
Compilers: convert programs written in a high-level language into the machine
language of some computer.
Syntax: Every structure in programming language has a precise form.
Semantic: Every structure in programming language has a precise meaning
26
Definitions
Using Google Colab
• Colab is an interactive editor for Python in the cloud
• To get started, open Google Colab in Chrome
• Sign in using your personal Google account
• Click ‘New Notebook’ or, if this is not an option, ‘File > New Notebook’
• Top right hand corner should look like this
• If not, click ‘connect’
27
Using Google Colab
• We run code in Google Colab by typing it in a code ‘cell’ and clicking the
play button
• Try the example above. We’ll explain what we wrote in one moment.
• Bonus: You can also run the contents of a cell using `ctrl+enter`
28
Printing
• Printing allows Python to talk to us. In the last example we used
printing to make Python say “Hello World”
• We can make Python say anything by writing a sentence, wrapped in
double quotes, and passing it as the input to print(…)
• The print function can also be used to perform arithmetic. Just replace
the input to of the print() with the expression you want to evaluate
• Note, in this case, we don’t need quotes. They were only to let Python
know that the input to print(…) was text
29
Printing
30
• You can print multiple things (which will be automatically separated by
spaces) by passing more than one input to print(…)
• We separate each input using a comma
• As we can see above, Python is happy to combine both text (using
double quotes) and arithmetic (no need for double quotes here
Printing Practice
31
• Print your name using the print() command
• Print your three favourite colours by passing them as three separate
inputs to print() (remember: separate each input with a comma)
• Calculate 26, multiplied by 66, add 13
• Calculate 6804 divided by 162 (hint: use / for division)
• Calculate 2 to the power of 8 (hint: use **)
• What happens if you put a mathematical expression in double quotes
when you are printing it?
• Print(“66+33”)
• Output ?
Printing Practice Solutions
32

Mais conteúdo relacionado

Semelhante a W1-Intro to python.pptx

python classes in thane
python classes in thanepython classes in thane
python classes in thanefaizrashid1995
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptxHaythamBarakeh1
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++KurdGul
 
Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowKathy Brown
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
Visualising the world of competitive programming with Python (Codeforces)
Visualising the world of competitive programming with Python (Codeforces)Visualising the world of competitive programming with Python (Codeforces)
Visualising the world of competitive programming with Python (Codeforces)Anuj Menta
 
GUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHONGUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHONLebogang Modise
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioMuralidharan Deenathayalan
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioMuralidharan Deenathayalan
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unitmichaelaaron25322
 
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...Dylan-Wu
 
Programming of c++
Programming of c++Programming of c++
Programming of c++Ateeq Sindhu
 
Autonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiAutonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiIvo Andreev
 

Semelhante a W1-Intro to python.pptx (20)

python classes in thane
python classes in thanepython classes in thane
python classes in thane
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
DMA113 Chap1
DMA113 Chap1DMA113 Chap1
DMA113 Chap1
 
Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To Know
 
Plc part 1
Plc part 1Plc part 1
Plc part 1
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
1
11
1
 
Visualising the world of competitive programming with Python (Codeforces)
Visualising the world of competitive programming with Python (Codeforces)Visualising the world of competitive programming with Python (Codeforces)
Visualising the world of competitive programming with Python (Codeforces)
 
GUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHONGUIDE TO PROGRAMMING WITH PYTHON
GUIDE TO PROGRAMMING WITH PYTHON
 
U3 l4 using simple commands
U3 l4 using simple commandsU3 l4 using simple commands
U3 l4 using simple commands
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
The Python Workshop.pdf
The Python Workshop.pdfThe Python Workshop.pdf
The Python Workshop.pdf
 
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
MITx 6.00.1x Introduction to Computer Science and Programming Using Python - ...
 
Programming of c++
Programming of c++Programming of c++
Programming of c++
 
Autonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiAutonomous Machines with Project Bonsai
Autonomous Machines with Project Bonsai
 

Último

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 

Último (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

W1-Intro to python.pptx

  • 1. CS114 - Fundamental of Programming Lecture 1: Introduction Dr. Nazia Perwaiz vision.seecs.edu.pk
  • 2. Content • Why programming for ChE Students? • Why Python? • Course Outline • Setting up Google Collab • Printing • Arithmetic with Python • Variables and variable typing 2
  • 4. Why Programming for ChE Students? 4
  • 5. Why Programming for ChE Students? 5
  • 6. Why Programming for ChE Students? 6
  • 7. Why Programming for ChE Students? 7
  • 8. Why Programming for ChE Students? 8
  • 9. 9
  • 11. 11 Python library ChemPlot for clustering the chemical space and selecting specific clusters https://chemistry-europe.onlinelibrary.wiley.com/doi/10.1002/cmtd.202200005
  • 12. 12 Produced Water Chemistry and Isotope Analysis with Python and Pandas https://hatarilabs.com/ih-en/produced-water-chemistry-and-isotope-analysis-with-python-and-pandas-tutorial
  • 13. 13 Taking the leap between analytical chemistry and artificial intelligence https://www.sciencedirect.com/science/article/abs/pii/S0003267021002294#undfig1
  • 14. Python for Chemical Engineering Applications Python used for chemical engineering tasks: 1. Process simulation: Pyomo is a Python library for modeling and solving mathematical optimization problems. It can be used to model and optimize chemical processes, such as distillation columns and reactors. 2. Data analysis: Pandas is a popular Python library for data analysis. It can be used to manipulate and analyze large sets of data, such as process data from sensors or experiments. 14
  • 15. Python for Chemical Engineering Applications 3. Visualization: Matplotlib is a Python library for creating visualizations. It can be used to create plots and charts of process variables, such as temperature and flow rate, to aid in understanding and analyzing data. 4. Kinetic model: Cantera is a Python library that can be used to create and simulate kinetic models of chemical reactions. It can be used to model combustion reactions, atmospheric chemistry and more. 5. Equation solving: Scipy has an optimize module that can be used to solve equations, it can be used to solve systems of non-linear equations, which is a common task in chemical engineering. 15
  • 17. Course Objectives 17 • Developing comprehensive knowledge about the fundamental principles, concepts and constructs of modern computer programming. • Developing competencies for the design, coding and debugging of computer programs.
  • 18. Course Learning Outcomes 18 • To understand the syntax and semantics of different programming constructs • To understand basic algorithms for identifying and solving real-world problems • To develop computer programs to implement these algorithms • To use the latest IDEs and other supplementary tools to aid implementation and code management
  • 19. Grading Breakdown 19 Theory - 75% • 30% Mid • 10% Quizzes • 10% Assignments • 50% Final Exam Labs - 25 % • 70% Lab Tasks • 30% Project
  • 20. Books 20 Text Book: 1. Python Basics: A Practical Introduction to Python 3, 4th Edition, David Amos, Fletcher Heisler, and Joanna Jablonski Reference Books: 1. A Practical Introduction to Python Programming, Brian Heinold 2. Introduction to Computation and Programming Using Python, John V. Guttag, The MIT Press 3. Practical Programming, An Introduction to Computer Science Using Python 3, 2nd Edition, Paul Gries, Jennifer Campbell, Jason Montojo
  • 21. Lesson Plan 21 Week Lecture Topic (Tentative) 01 Introduction, Programming Fundamentals, Introduction to Python 02 Variables, expressions, and data types 03 Operators (Arithmetic & Logical) 04 Algorithms, pseudo code, and flow charts 05 Decision making 06 Loops 07 Loops 08 Functions 09 Mid Semester Exam 10 Functions 11 Arrays 12 Strings 13 Lists 14 Searching, sorting 15 Lists’ applications 16 Creating graphical user interfaces (GUI) 17 Project Demos/ Presentations 18 End Semester Exam
  • 26. High-level Language: Designed to be used and understood by humans Low-level Language: Computer hardware can only understand a very low level language known as machine language Compilers: convert programs written in a high-level language into the machine language of some computer. Syntax: Every structure in programming language has a precise form. Semantic: Every structure in programming language has a precise meaning 26 Definitions
  • 27. Using Google Colab • Colab is an interactive editor for Python in the cloud • To get started, open Google Colab in Chrome • Sign in using your personal Google account • Click ‘New Notebook’ or, if this is not an option, ‘File > New Notebook’ • Top right hand corner should look like this • If not, click ‘connect’ 27
  • 28. Using Google Colab • We run code in Google Colab by typing it in a code ‘cell’ and clicking the play button • Try the example above. We’ll explain what we wrote in one moment. • Bonus: You can also run the contents of a cell using `ctrl+enter` 28
  • 29. Printing • Printing allows Python to talk to us. In the last example we used printing to make Python say “Hello World” • We can make Python say anything by writing a sentence, wrapped in double quotes, and passing it as the input to print(…) • The print function can also be used to perform arithmetic. Just replace the input to of the print() with the expression you want to evaluate • Note, in this case, we don’t need quotes. They were only to let Python know that the input to print(…) was text 29
  • 30. Printing 30 • You can print multiple things (which will be automatically separated by spaces) by passing more than one input to print(…) • We separate each input using a comma • As we can see above, Python is happy to combine both text (using double quotes) and arithmetic (no need for double quotes here
  • 31. Printing Practice 31 • Print your name using the print() command • Print your three favourite colours by passing them as three separate inputs to print() (remember: separate each input with a comma) • Calculate 26, multiplied by 66, add 13 • Calculate 6804 divided by 162 (hint: use / for division) • Calculate 2 to the power of 8 (hint: use **) • What happens if you put a mathematical expression in double quotes when you are printing it? • Print(“66+33”) • Output ?