SlideShare a Scribd company logo
1 of 27
Download to read offline
Introduction to Python

          Lecture 2
       Kasyanov Anton



          IASA 2011
Plan

   Variables
   Types
   Functions
   If operator
Variables

   A variable is a name that refers to a value.
   Variables let us store and reuse values in
    several places.
   Python is dynamically typed. That means that
    we don't need to specify variable's type.
Variables, assignment

   Form: variable = expression
       An expression is a legal sentence in python that
        can be evaluated.
       So we will put math expressions into the shell and
        seen them be evaluated to single numbers.
   What it does:
       1. Evaluate the expression on the RHS.(This value
        is a memory address)
       2. Store the memory address in the variable.
Variables, assignment

   What this means is that a variable is a name
    and a memory address. The name points to a
    memory address where the value is stored.
Practice

   Let's play with python shell
Functions

   Useful but simple to create.
   First let's think about what it means to define a
    function in math.
       Consider f(x)=x^2.
   In python we can do the same with:
   def f(x):
         return x**2

Functions

   A function definition has the form:
        def function_name(parameters):
                    block
       def is a python keyword; it cannot be used for
        naming functions or variables.
       A parameter of a function is a variable. A function
        can have any number of parameters, including 0.
       A block is a sequence of legal python statements.
                   A block must be indented.
       If the block contains the keyword return, it returns a
        value; otherwise it returns the special value None.
Functions documentation

   We can use the built-in function help() to get
    information on functions or modules.
   We can do this on functions that we've defined
    as well, but it doesn't give much information.
   We can add useful documentation with
    docstrings.
       A docstring is surrounded by ''' and must be the first
        line of a module or function.
Docstrings

   If the first line of a function or module is a
    string, we call it a docstring.
       Short for documentation string.
   Python saves the string to return if the help
    function is called.
   Convention: Leave a blank line after but not
    before a docstring.
   All functions should have docstrings.
Naming conventions

   Naming rules and conventions apply to
    functions, variables and any other kind of name
    that you will see.
   Must start with a letter or underscore.
   Can include letters, numbers, and underscores
    and nothing else.
   Case matters, so age is not same name as
    Age.
Name conventions

   For variables and functions pothole_case is
    used
       variable_name, useful_function
   CamelCase is sometimes used, but not for
    variables and functions
       MyClass
Types

   Every variable has a type
   Use built-in function type()
   Type converting is available
Booleans

   Can have two values True, False.
   Have three operations: not, and, or.
   not changes a True to a False and vice versa.
   and returns False unless all the arguments are
    True.
   or returns True unless all the arguments are
    False.
Booleans

   We can use relational operators.
       <,>,<=,>=,!=, ==
   These are all comparison operators that return
    True or False.
   == is the equality operator.
   != is not equals.
Practice

   Let's use Python shell and play with types.
If statement

   The general form of an if statement is:
      if condition:
        block
   Example:
      if grade >=50:
        print “pass”
If statement

   The general form of an if statement is:
      if condition:
        block
   The condition is a boolean expression.
   Recall that a block is a series of python
    statements.
   If the condition evaluates to true the block is
    executed.
If statement

   If we want to execute different lines of code
    based on the outcome of the boolean
    expression we can use:
      if condition:
        block
      else:
        block
   The block under the else is executed if the
    condition evaluates to false.
Elif

if condition1:
    block
elif condition2:
    block
elif condition3:
    block
else:
    block
Practice

   Changing photo to make it look like it's sunset
    using Python.
   Sunset is when red color is main on the photo.
   Let's decrease blue and green components of
    each pixel.
   We will use Python Imaging Library (PIL).
Workflow

   Load an image
   Get it's size
   Step through all pixels
       Get color of this pixel
       Change it
       Put it back
   Save the image
Home assignment

   Create all following functions:
   xor(bool, bool) – returns result of xor operation
   distance(int, int, int, int) – returns (float)
    distance between (x1,y1) and (x2, y2)
   percent(int, int) - if a<b then returns (int)
    percent of a according to b, else returns -1
Home assignment

   Send to mind_master@ukr.net due to 17.10
    (Monday)
   Just functions.py file
   First line is import math
   Math.sqrt() is useful
Any questions?

More Related Content

What's hot

NaBL: A Meta-Language for Declarative Name Binding and Scope Rules
NaBL: A Meta-Language for Declarative Name Binding  and Scope RulesNaBL: A Meta-Language for Declarative Name Binding  and Scope Rules
NaBL: A Meta-Language for Declarative Name Binding and Scope RulesEelco Visser
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Syed Farjad Zia Zaidi
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiersNilimesh Halder
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3Syed Farjad Zia Zaidi
 
Interpreter Design Pattern
Interpreter Design PatternInterpreter Design Pattern
Interpreter Design Patternsreymoch
 
Double pointer (pointer to pointer)
Double pointer (pointer to pointer)Double pointer (pointer to pointer)
Double pointer (pointer to pointer)sangrampatil81
 
Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Gamindu Udayanga
 
Python functions
Python functionsPython functions
Python functionsAliyamanasa
 
Python Built-in Functions and Use cases
Python Built-in Functions and Use casesPython Built-in Functions and Use cases
Python Built-in Functions and Use casesSrajan Mor
 
Site visit presentation 2012 12 14
Site visit presentation 2012 12 14Site visit presentation 2012 12 14
Site visit presentation 2012 12 14Mitchell Wand
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 

What's hot (20)

NaBL: A Meta-Language for Declarative Name Binding and Scope Rules
NaBL: A Meta-Language for Declarative Name Binding  and Scope RulesNaBL: A Meta-Language for Declarative Name Binding  and Scope Rules
NaBL: A Meta-Language for Declarative Name Binding and Scope Rules
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
 
Interpreter Design Pattern
Interpreter Design PatternInterpreter Design Pattern
Interpreter Design Pattern
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Interpreter Case Study - Design Patterns
Interpreter Case Study - Design PatternsInterpreter Case Study - Design Patterns
Interpreter Case Study - Design Patterns
 
Double pointer (pointer to pointer)
Double pointer (pointer to pointer)Double pointer (pointer to pointer)
Double pointer (pointer to pointer)
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python basics
Python basicsPython basics
Python basics
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++
 
Python functions
Python functionsPython functions
Python functions
 
Notes on c++
Notes on c++Notes on c++
Notes on c++
 
Python Built-in Functions and Use cases
Python Built-in Functions and Use casesPython Built-in Functions and Use cases
Python Built-in Functions and Use cases
 
Site visit presentation 2012 12 14
Site visit presentation 2012 12 14Site visit presentation 2012 12 14
Site visit presentation 2012 12 14
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
Python and You Series
Python and You SeriesPython and You Series
Python and You Series
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 

Viewers also liked

Ruby on Rails For .Net Programmers
Ruby on Rails For .Net ProgrammersRuby on Rails For .Net Programmers
Ruby on Rails For .Net Programmersdaveverwer
 
Programming with Python - Week 2
Programming with Python - Week 2Programming with Python - Week 2
Programming with Python - Week 2Ahmet Bulut
 
Play with python lecture 2
Play with python lecture 2Play with python lecture 2
Play with python lecture 2iloveallahsomuch
 
Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...
Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...
Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...Justin Gordon
 
Mouse and keyboard in phython
Mouse and keyboard in phythonMouse and keyboard in phython
Mouse and keyboard in phythonabdulla_binkalban
 
Python 2 - 快速簡介
Python 2 - 快速簡介Python 2 - 快速簡介
Python 2 - 快速簡介Cheyin L
 
Python programming advance lab api npr 2
Python programming advance lab api npr  2Python programming advance lab api npr  2
Python programming advance lab api npr 2profbnk
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programmingASIT Education
 
Java swing
Java swingJava swing
Java swingprofbnk
 
MHIT 603: Introduction to Prototyping
MHIT 603: Introduction to PrototypingMHIT 603: Introduction to Prototyping
MHIT 603: Introduction to PrototypingMark Billinghurst
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in javaAdil Mehmoood
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsRanel Padon
 
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...Ranel Padon
 

Viewers also liked (20)

Ruby on Rails For .Net Programmers
Ruby on Rails For .Net ProgrammersRuby on Rails For .Net Programmers
Ruby on Rails For .Net Programmers
 
Programming with Python - Week 2
Programming with Python - Week 2Programming with Python - Week 2
Programming with Python - Week 2
 
Play with python lecture 2
Play with python lecture 2Play with python lecture 2
Play with python lecture 2
 
25 awt
25 awt25 awt
25 awt
 
Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...
Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...
Slides with notes from Ruby Conf 2014 on using simple techniques to create sl...
 
Report swings
Report swingsReport swings
Report swings
 
Mouse and keyboard in phython
Mouse and keyboard in phythonMouse and keyboard in phython
Mouse and keyboard in phython
 
Python 2 - 快速簡介
Python 2 - 快速簡介Python 2 - 快速簡介
Python 2 - 快速簡介
 
28 awt
28 awt28 awt
28 awt
 
Python - Lecture 2
Python - Lecture 2Python - Lecture 2
Python - Lecture 2
 
Python programming advance lab api npr 2
Python programming advance lab api npr  2Python programming advance lab api npr  2
Python programming advance lab api npr 2
 
AWT
AWT AWT
AWT
 
Introduction to phython programming
Introduction to phython programmingIntroduction to phython programming
Introduction to phython programming
 
java2 swing
java2 swingjava2 swing
java2 swing
 
Java swing
Java swingJava swing
Java swing
 
MHIT 603: Introduction to Prototyping
MHIT 603: Introduction to PrototypingMHIT 603: Introduction to Prototyping
MHIT 603: Introduction to Prototyping
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and Objects
 
Java swings
Java swingsJava swings
Java swings
 
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
 

Similar to Anton Kasyanov, Introduction to Python, Lecture2

INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONSINTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONSKalaivaniD12
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning ParrotAI
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSAniruddha Paul
 
Functions2.pdf
Functions2.pdfFunctions2.pdf
Functions2.pdfprasnt1
 
Python_Unit_2.pdf
Python_Unit_2.pdfPython_Unit_2.pdf
Python_Unit_2.pdfalaparthi
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.pptjaba kumar
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answerskavinilavuG
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2Prerna Sharma
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questionsgokul174578
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answersRojaPriya
 
Phyton Learning extracts
Phyton Learning extracts Phyton Learning extracts
Phyton Learning extracts Pavan Babu .G
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizeIruolagbePius
 
Functions in Python Syntax and working .
Functions in Python Syntax and working .Functions in Python Syntax and working .
Functions in Python Syntax and working .tarunsharmaug23
 

Similar to Anton Kasyanov, Introduction to Python, Lecture2 (20)

INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONSINTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
INTRODUCTION TO PYTHON PROGRMMING AND FUNCTIONS
 
functions- best.pdf
functions- best.pdffunctions- best.pdf
functions- best.pdf
 
functions-.pdf
functions-.pdffunctions-.pdf
functions-.pdf
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
Python-Functions.pptx
Python-Functions.pptxPython-Functions.pptx
Python-Functions.pptx
 
Functions2.pdf
Functions2.pdfFunctions2.pdf
Functions2.pdf
 
Python_Unit_2.pdf
Python_Unit_2.pdfPython_Unit_2.pdf
Python_Unit_2.pdf
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
 
Php, mysq lpart3
Php, mysq lpart3Php, mysq lpart3
Php, mysq lpart3
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
 
functionnotes.pdf
functionnotes.pdffunctionnotes.pdf
functionnotes.pdf
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Phyton Learning extracts
Phyton Learning extracts Phyton Learning extracts
Phyton Learning extracts
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
Python Session - 4
Python Session - 4Python Session - 4
Python Session - 4
 
Functions in Python Syntax and working .
Functions in Python Syntax and working .Functions in Python Syntax and working .
Functions in Python Syntax and working .
 

More from Anton Kasyanov

spaCy lightning talk for KyivPy #21
spaCy lightning talk for KyivPy #21spaCy lightning talk for KyivPy #21
spaCy lightning talk for KyivPy #21Anton Kasyanov
 
Introduction to Computer Vision (uapycon 2017)
Introduction to Computer Vision (uapycon 2017)Introduction to Computer Vision (uapycon 2017)
Introduction to Computer Vision (uapycon 2017)Anton Kasyanov
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov
 
Anton Kasyanov, Introduction to Python, Lecture1
Anton Kasyanov, Introduction to Python, Lecture1Anton Kasyanov, Introduction to Python, Lecture1
Anton Kasyanov, Introduction to Python, Lecture1Anton Kasyanov
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov
 

More from Anton Kasyanov (7)

spaCy lightning talk for KyivPy #21
spaCy lightning talk for KyivPy #21spaCy lightning talk for KyivPy #21
spaCy lightning talk for KyivPy #21
 
Introduction to Computer Vision (uapycon 2017)
Introduction to Computer Vision (uapycon 2017)Introduction to Computer Vision (uapycon 2017)
Introduction to Computer Vision (uapycon 2017)
 
aiohttp intro
aiohttp introaiohttp intro
aiohttp intro
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3
 
Anton Kasyanov, Introduction to Python, Lecture1
Anton Kasyanov, Introduction to Python, Lecture1Anton Kasyanov, Introduction to Python, Lecture1
Anton Kasyanov, Introduction to Python, Lecture1
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4
 

Anton Kasyanov, Introduction to Python, Lecture2

  • 1. Introduction to Python Lecture 2 Kasyanov Anton IASA 2011
  • 2. Plan  Variables  Types  Functions  If operator
  • 3. Variables  A variable is a name that refers to a value.  Variables let us store and reuse values in several places.  Python is dynamically typed. That means that we don't need to specify variable's type.
  • 4. Variables, assignment  Form: variable = expression  An expression is a legal sentence in python that can be evaluated.  So we will put math expressions into the shell and seen them be evaluated to single numbers.  What it does:  1. Evaluate the expression on the RHS.(This value is a memory address)  2. Store the memory address in the variable.
  • 5. Variables, assignment  What this means is that a variable is a name and a memory address. The name points to a memory address where the value is stored.
  • 6. Practice  Let's play with python shell
  • 7. Functions  Useful but simple to create.  First let's think about what it means to define a function in math.  Consider f(x)=x^2.  In python we can do the same with:  def f(x): return x**2 
  • 8. Functions  A function definition has the form: def function_name(parameters): block  def is a python keyword; it cannot be used for naming functions or variables.  A parameter of a function is a variable. A function can have any number of parameters, including 0.  A block is a sequence of legal python statements.  A block must be indented.  If the block contains the keyword return, it returns a value; otherwise it returns the special value None.
  • 9. Functions documentation  We can use the built-in function help() to get information on functions or modules.  We can do this on functions that we've defined as well, but it doesn't give much information.  We can add useful documentation with docstrings.  A docstring is surrounded by ''' and must be the first line of a module or function.
  • 10.
  • 11. Docstrings  If the first line of a function or module is a string, we call it a docstring.  Short for documentation string.  Python saves the string to return if the help function is called.  Convention: Leave a blank line after but not before a docstring.  All functions should have docstrings.
  • 12.
  • 13. Naming conventions  Naming rules and conventions apply to functions, variables and any other kind of name that you will see.  Must start with a letter or underscore.  Can include letters, numbers, and underscores and nothing else.  Case matters, so age is not same name as Age.
  • 14. Name conventions  For variables and functions pothole_case is used  variable_name, useful_function  CamelCase is sometimes used, but not for variables and functions  MyClass
  • 15. Types  Every variable has a type  Use built-in function type()  Type converting is available
  • 16. Booleans  Can have two values True, False.  Have three operations: not, and, or.  not changes a True to a False and vice versa.  and returns False unless all the arguments are True.  or returns True unless all the arguments are False.
  • 17. Booleans  We can use relational operators.  <,>,<=,>=,!=, ==  These are all comparison operators that return True or False.  == is the equality operator.  != is not equals.
  • 18. Practice  Let's use Python shell and play with types.
  • 19. If statement  The general form of an if statement is: if condition: block  Example: if grade >=50: print “pass”
  • 20. If statement  The general form of an if statement is: if condition: block  The condition is a boolean expression.  Recall that a block is a series of python statements.  If the condition evaluates to true the block is executed.
  • 21. If statement  If we want to execute different lines of code based on the outcome of the boolean expression we can use: if condition: block else: block  The block under the else is executed if the condition evaluates to false.
  • 22. Elif if condition1: block elif condition2: block elif condition3: block else: block
  • 23. Practice  Changing photo to make it look like it's sunset using Python.  Sunset is when red color is main on the photo.  Let's decrease blue and green components of each pixel.  We will use Python Imaging Library (PIL).
  • 24. Workflow  Load an image  Get it's size  Step through all pixels  Get color of this pixel  Change it  Put it back  Save the image
  • 25. Home assignment  Create all following functions:  xor(bool, bool) – returns result of xor operation  distance(int, int, int, int) – returns (float) distance between (x1,y1) and (x2, y2)  percent(int, int) - if a<b then returns (int) percent of a according to b, else returns -1
  • 26. Home assignment  Send to mind_master@ukr.net due to 17.10 (Monday)  Just functions.py file  First line is import math  Math.sqrt() is useful