SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
+
Dr. Ramadan Babers
Faculty of Science - Helwan University
Spring – 2019
Python
LEC - 02
for
Biologists
https://www.linkedin.com/in/ramadan-babers-phd-78976345
+
Introduction
2
Chapter 1 Outlines
 What Is Python?
 General Examples
 Flowcharts Examples (area)
3
1. What Is Python?
4
• Python is a general-purpose
programming language.
• It was designed and developed
to write software for a wide
variety of disciplines.
• Python has been used to write
applications to solve problems in
- biology,
- chemistry,
- financial analysis,
- numerical analysis,
- robotics, and many other fields.
1.1 History
5
• Invented in the Netherlands,early
90s by Guido van Rossum
• Named after Monty Python
• Open sourced from the beginning
• Considered a scripting language,
but is much more
• Scalable, object oriented and
functional from the beginning
• Used by Google from the
beginning
• Increasingly popular
1.2 URLs
6
• Open source general-purpose language.
• Object Oriented, Procedural, Functional
• Great interactive environment
• Downloads: http://www.python.org
• Documentation: http://www.python.org/doc/
• Free book: http://www.diveintopython.org
1.3 ANACONDA NAVIGATOR
7
1.4 Help
8
Python 3.6 Module Docs
+
General Examples
9
1. Flowcharts Examples (area)
10
Example (1)
Calculate the area of a
rectangle, given the length
(L) and width (w).
11
Algorithm:
Step 1 : input first number
Step 2 : input second number
Step 3 : multiply two numbers and
store result in Area
Step 4 : print Area
12
1. Flowcharts Examples (area)
2. Python Examples (user input)
12
+
13
+
Introduction
and
Environment
14
Chapter: 1
15
Why have a programming book for biologists?
A biology-specific programming book allows us to
use examples and exercises that use biological
problems.
This serves two important purposes:
 firstly, it provides motivation and demonstrates the
types of problems that programming can help to
solve.
 Secondly, by using biological examples, the code and
exercises throughout the book can form a library of
useful code snippets, which we can refer back to
when we want to solve real-life problems.
16
Why Python?
The choice of programming language does
matter, of course.To put it another ways, choosing
the "wrong" programming language is very
unlikely to mean the difference between failure
and success when learning.
learning a first programming language gets you
90% of the way towards learning a second, third,
and fourth one. Learning to think like a
programmer in the way that you break down
complex tasks into simple ones is a skill that cuts
across all languages
+
Printing
and
Manipulating Text
17
Chapter: 2
18
Why are we so interested in working with text?
String is the word we use to refer to a bit of text
in a computer program (it just means a string of
characters).
From this point on we'll use the word string
when we're talking about computer code, and
we'll reserve the word sequence for when we're
discussing biological sequences like DNA and
protein.
19
Printing a message to the screen
Name of a function
parentheses
arguments
• The whole line is called a
statement.
• print is the name of a function.
The function tells Python, in
vague terms, what we want to do
– in this case, we want to print
some text. The function name is
alwaysfollowed by parentheses.
• The bits of text inside the
parentheses are called the
arguments to the function.
20
Quotes are important
 strings are always surrounded by quotes.That is how
Python is able to tell the difference between:
o the instructions (like the function name) and
o the data (the thing we want to print).
We can use either
single or double
quotes for strings
21
Quotes are important
 You'll notice that the pervious output doesn't contain
quotes – they are part of the code, not part of the string
itself.
 If we do want to include quotes in the output,
22
Quotes are important - Quiz
 Print the following
“He said”,“Hello Word”
23
Use comments to annotate your code
 Comments are a very useful way to document your
code,You can put the explanation of what a particular
bit of code does right next to the code itself.
24
Error messages and debugging
Forgetting quotes Spelling mistakes
Programming languages are not like
natural languages – they have a very
strict set of rules, and if you break any
of them, the computer will not attempt
to guess what you intended, but
instead will stop running and present
you with an error message.
25
Splitting a statement over two lines
26
 Python got confused
about whether the new
line was
 part of the string
(which is what we wanted) or
 part of the source code
(which is how it was actually
interpreted).
Printing special characters
27
Printing special characters

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Which One Should You Learn: Java Or Python?
Which One Should You Learn: Java Or Python?Which One Should You Learn: Java Or Python?
Which One Should You Learn: Java Or Python?
 
Chapter 3 what is programming
Chapter 3   what is programmingChapter 3   what is programming
Chapter 3 what is programming
 
Input, Processing and Output
Input, Processing and OutputInput, Processing and Output
Input, Processing and Output
 
Language translator
Language translatorLanguage translator
Language translator
 
STARTING A CAREER IN PROGRAMMING
STARTING A CAREER IN PROGRAMMINGSTARTING A CAREER IN PROGRAMMING
STARTING A CAREER IN PROGRAMMING
 
Description about python
Description about pythonDescription about python
Description about python
 
Software Project Proposal: Bengali Braille to Text Translation
Software Project Proposal: Bengali Braille to Text TranslationSoftware Project Proposal: Bengali Braille to Text Translation
Software Project Proposal: Bengali Braille to Text Translation
 
Lset's guide for android application development
Lset's guide for android application developmentLset's guide for android application development
Lset's guide for android application development
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Lecture 21 - Preprocessor and Header File
Lecture 21 - Preprocessor and Header FileLecture 21 - Preprocessor and Header File
Lecture 21 - Preprocessor and Header File
 
Career in python
Career in pythonCareer in python
Career in python
 
Abstract- Bengali Braille to Text Translator
Abstract- Bengali Braille to Text TranslatorAbstract- Bengali Braille to Text Translator
Abstract- Bengali Braille to Text Translator
 
Basic introduction to python
Basic introduction to pythonBasic introduction to python
Basic introduction to python
 
Introduction to coding and Python
Introduction to coding and PythonIntroduction to coding and Python
Introduction to coding and Python
 
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjarTRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
TRANSLATOR'S TOOLS, by Dr. Shadia Y. BAnjar
 
Adam Goucher I18n And L10n
Adam Goucher   I18n And L10nAdam Goucher   I18n And L10n
Adam Goucher I18n And L10n
 
Machine Tanslation
Machine TanslationMachine Tanslation
Machine Tanslation
 
Generations of programming language
Generations of programming languageGenerations of programming language
Generations of programming language
 
Programming paradigm and web programming
Programming paradigm and web programmingProgramming paradigm and web programming
Programming paradigm and web programming
 
Machine Learning Techniques in Python Dissertation - Phdassistance
Machine Learning Techniques in Python Dissertation - PhdassistanceMachine Learning Techniques in Python Dissertation - Phdassistance
Machine Learning Techniques in Python Dissertation - Phdassistance
 

Ähnlich wie Python lec 1002_for_biologists

Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
Manohar k
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
Laxman Puri
 
Python-Mastering-the-Language-of-Data-Science.pptx
Python-Mastering-the-Language-of-Data-Science.pptxPython-Mastering-the-Language-of-Data-Science.pptx
Python-Mastering-the-Language-of-Data-Science.pptx
dmdHaneef
 
Introducing Python Tutorial.pdf
Introducing Python Tutorial.pdfIntroducing Python Tutorial.pdf
Introducing Python Tutorial.pdf
rubaabNaseer
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
cigogag569
 

Ähnlich wie Python lec 1002_for_biologists (20)

Python basics
Python basicsPython basics
Python basics
 
Research paper on python by Rj
Research paper on python by RjResearch paper on python by Rj
Research paper on python by Rj
 
What is Python.pptx
What is Python.pptxWhat is Python.pptx
What is Python.pptx
 
Python_Interview_Questions.pdf
Python_Interview_Questions.pdfPython_Interview_Questions.pdf
Python_Interview_Questions.pdf
 
python-handbook.pdf
python-handbook.pdfpython-handbook.pdf
python-handbook.pdf
 
IRJET- Python: Simple though an Important Programming Language
IRJET- Python: Simple though an Important Programming LanguageIRJET- Python: Simple though an Important Programming Language
IRJET- Python: Simple though an Important Programming Language
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
 
Python
PythonPython
Python
 
How To Tame Python
How To Tame PythonHow To Tame Python
How To Tame Python
 
python classes in thane
python classes in thanepython classes in thane
python classes in thane
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
All you need to know about Python | BJIT
All you need to know about Python | BJITAll you need to know about Python | BJIT
All you need to know about Python | BJIT
 
Why Python in required in Civil Engineering
Why Python in required in Civil EngineeringWhy Python in required in Civil Engineering
Why Python in required in Civil Engineering
 
summer t.pdf
summer t.pdfsummer t.pdf
summer t.pdf
 
python.docx
python.docxpython.docx
python.docx
 
Python-Mastering-the-Language-of-Data-Science.pptx
Python-Mastering-the-Language-of-Data-Science.pptxPython-Mastering-the-Language-of-Data-Science.pptx
Python-Mastering-the-Language-of-Data-Science.pptx
 
Introducing Python Tutorial.pdf
Introducing Python Tutorial.pdfIntroducing Python Tutorial.pdf
Introducing Python Tutorial.pdf
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
 

Mehr von Ramadan Babers, PhD

Mehr von Ramadan Babers, PhD (20)

Part10 finance investment limitations of ratio analysis
Part10 finance investment limitations of ratio analysisPart10 finance investment limitations of ratio analysis
Part10 finance investment limitations of ratio analysis
 
Part09 finance investment ratio analysis investment ratio
Part09 finance investment ratio analysis investment ratioPart09 finance investment ratio analysis investment ratio
Part09 finance investment ratio analysis investment ratio
 
Part08 finance investment ratio analysis solvency ratio
Part08 finance investment ratio analysis solvency ratioPart08 finance investment ratio analysis solvency ratio
Part08 finance investment ratio analysis solvency ratio
 
Part07 finance investment ratio analysis profitability ratio
Part07 finance investment ratio analysis profitability ratioPart07 finance investment ratio analysis profitability ratio
Part07 finance investment ratio analysis profitability ratio
 
Part06 finance investment ratio analysis efficiency ratio
Part06 finance investment ratio analysis efficiency ratioPart06 finance investment ratio analysis efficiency ratio
Part06 finance investment ratio analysis efficiency ratio
 
Part05 finance investment_ratio_analysis_liquidity_ratio_presentation
Part05 finance investment_ratio_analysis_liquidity_ratio_presentationPart05 finance investment_ratio_analysis_liquidity_ratio_presentation
Part05 finance investment_ratio_analysis_liquidity_ratio_presentation
 
Part04 finance investment_ratio_analysis_introduction_presentation
Part04 finance investment_ratio_analysis_introduction_presentationPart04 finance investment_ratio_analysis_introduction_presentation
Part04 finance investment_ratio_analysis_introduction_presentation
 
Part03 finance investment_financial_statement_analysis_presentation
Part03 finance investment_financial_statement_analysis_presentationPart03 finance investment_financial_statement_analysis_presentation
Part03 finance investment_financial_statement_analysis_presentation
 
Part02 finance investment_finance_and_financial_reporting_presentation
Part02 finance investment_finance_and_financial_reporting_presentationPart02 finance investment_finance_and_financial_reporting_presentation
Part02 finance investment_finance_and_financial_reporting_presentation
 
Part01 finance investment_basics_presentation
Part01 finance investment_basics_presentationPart01 finance investment_basics_presentation
Part01 finance investment_basics_presentation
 
Strategic Management part_03_03
Strategic Management part_03_03Strategic Management part_03_03
Strategic Management part_03_03
 
Strategic Management part_02_03
Strategic Management part_02_03Strategic Management part_02_03
Strategic Management part_02_03
 
Strategic Management part_01_03
Strategic Management part_01_03Strategic Management part_01_03
Strategic Management part_01_03
 
Customer Experience (CX) updated version V9.0
Customer Experience (CX) updated version V9.0Customer Experience (CX) updated version V9.0
Customer Experience (CX) updated version V9.0
 
Classification using decision tree in detail
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detail
 
Customer Experience (CX)
Customer Experience (CX)Customer Experience (CX)
Customer Experience (CX)
 
Python lec 1004_ch02_excercies
Python lec 1004_ch02_excerciesPython lec 1004_ch02_excercies
Python lec 1004_ch02_excercies
 
Python lec 1003_for_biologists
Python lec 1003_for_biologistsPython lec 1003_for_biologists
Python lec 1003_for_biologists
 
Db lec 08_new
Db lec 08_newDb lec 08_new
Db lec 08_new
 
Db lec 07_new
Db lec 07_newDb lec 07_new
Db lec 07_new
 

Kürzlich hochgeladen

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
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
PECB
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

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"
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.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
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Python lec 1002_for_biologists

  • 1. + Dr. Ramadan Babers Faculty of Science - Helwan University Spring – 2019 Python LEC - 02 for Biologists https://www.linkedin.com/in/ramadan-babers-phd-78976345
  • 3. Chapter 1 Outlines  What Is Python?  General Examples  Flowcharts Examples (area) 3
  • 4. 1. What Is Python? 4 • Python is a general-purpose programming language. • It was designed and developed to write software for a wide variety of disciplines. • Python has been used to write applications to solve problems in - biology, - chemistry, - financial analysis, - numerical analysis, - robotics, and many other fields.
  • 5. 1.1 History 5 • Invented in the Netherlands,early 90s by Guido van Rossum • Named after Monty Python • Open sourced from the beginning • Considered a scripting language, but is much more • Scalable, object oriented and functional from the beginning • Used by Google from the beginning • Increasingly popular
  • 6. 1.2 URLs 6 • Open source general-purpose language. • Object Oriented, Procedural, Functional • Great interactive environment • Downloads: http://www.python.org • Documentation: http://www.python.org/doc/ • Free book: http://www.diveintopython.org
  • 8. 1.4 Help 8 Python 3.6 Module Docs
  • 10. 1. Flowcharts Examples (area) 10 Example (1) Calculate the area of a rectangle, given the length (L) and width (w).
  • 11. 11 Algorithm: Step 1 : input first number Step 2 : input second number Step 3 : multiply two numbers and store result in Area Step 4 : print Area 12 1. Flowcharts Examples (area)
  • 12. 2. Python Examples (user input) 12
  • 13. + 13
  • 15. 15 Why have a programming book for biologists? A biology-specific programming book allows us to use examples and exercises that use biological problems. This serves two important purposes:  firstly, it provides motivation and demonstrates the types of problems that programming can help to solve.  Secondly, by using biological examples, the code and exercises throughout the book can form a library of useful code snippets, which we can refer back to when we want to solve real-life problems.
  • 16. 16 Why Python? The choice of programming language does matter, of course.To put it another ways, choosing the "wrong" programming language is very unlikely to mean the difference between failure and success when learning. learning a first programming language gets you 90% of the way towards learning a second, third, and fourth one. Learning to think like a programmer in the way that you break down complex tasks into simple ones is a skill that cuts across all languages
  • 18. 18 Why are we so interested in working with text? String is the word we use to refer to a bit of text in a computer program (it just means a string of characters). From this point on we'll use the word string when we're talking about computer code, and we'll reserve the word sequence for when we're discussing biological sequences like DNA and protein.
  • 19. 19 Printing a message to the screen Name of a function parentheses arguments • The whole line is called a statement. • print is the name of a function. The function tells Python, in vague terms, what we want to do – in this case, we want to print some text. The function name is alwaysfollowed by parentheses. • The bits of text inside the parentheses are called the arguments to the function.
  • 20. 20 Quotes are important  strings are always surrounded by quotes.That is how Python is able to tell the difference between: o the instructions (like the function name) and o the data (the thing we want to print). We can use either single or double quotes for strings
  • 21. 21 Quotes are important  You'll notice that the pervious output doesn't contain quotes – they are part of the code, not part of the string itself.  If we do want to include quotes in the output,
  • 22. 22 Quotes are important - Quiz  Print the following “He said”,“Hello Word”
  • 23. 23 Use comments to annotate your code  Comments are a very useful way to document your code,You can put the explanation of what a particular bit of code does right next to the code itself.
  • 24. 24 Error messages and debugging Forgetting quotes Spelling mistakes Programming languages are not like natural languages – they have a very strict set of rules, and if you break any of them, the computer will not attempt to guess what you intended, but instead will stop running and present you with an error message.
  • 25. 25 Splitting a statement over two lines
  • 26. 26  Python got confused about whether the new line was  part of the string (which is what we wanted) or  part of the source code (which is how it was actually interpreted). Printing special characters