Presentation is loading. Please wait.

Presentation is loading. Please wait.

CONDITIONALS. Boolean values Boolean value is either true or false It is name after the British mathemetician, George Boole who first formulated Boolean.

Similar presentations


Presentation on theme: "CONDITIONALS. Boolean values Boolean value is either true or false It is name after the British mathemetician, George Boole who first formulated Boolean."— Presentation transcript:

1 CONDITIONALS

2 Boolean values Boolean value is either true or false It is name after the British mathemetician, George Boole who first formulated Boolean Algebra

3 Boolean expressions Boolean expression is an expression that evaluates to produce a result which a Boolean value.

4 Six common comparison operators

5 Boolean can be assigned to variables, printed, etc

6 Logical Operators

7 Conditional execution

8

9 Omitting the else clause

10 Chained conditionals

11 Nested Conditionals

12 The return statement with or without a value, depending on whether the function is fruitful or void. Allow to terminate the execution of a function before reach the end. One reason to use an early return is if an error condition was detected.

13 The return statement

14 Logical opposites OperatorLogical Opposite ==!= == <>= <=> > >=<

15 Logical opposites

16 de Morgan’s laws Two powerful simplified laws called de Morgan’s laws that are often helpful for complicated Boolean expressions. not (x and y) == (not x) or (not y) not (x or y) == (not x) and (not y)

17

18 Type conversion Many Python types come with a built-in function that attempts to convert values of another type into its own type. – int function – float function – str function

19

20 float function

21 str function

22 A Turtle Bar Chart

23

24


Download ppt "CONDITIONALS. Boolean values Boolean value is either true or false It is name after the British mathemetician, George Boole who first formulated Boolean."

Similar presentations


Ads by Google