Assignment, Variables, Constants & Sequences
Inputs, Outputs & Type Conversion
IF Statements & Boolean Operators
Nested Selection and Iteration
WHILE, REPEAT-UNTIL Loops
Validation and verification
Validation and authentication routines
High-level & Low-level languages
Assemblers, Compilers & Interpreters
Comparison operators are used to compare values. It either returns True or False according to the condition.
Python uses operators to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated. For example:
Run the above code ito see what it does.
Run the above code in python and then change the question marks in the comments to say what happens when the code is run.
Notice that variable assignment is done using a single equals operator "=", whereas comparison between two variables is done using the double equals operator "==". The "not equals" operator is marked as "!=".
Change the above code so that it prints out the following:
In Python The 'if' statement is used to conditionally execute a statement. In other words we look at a statement(conditional) and decide if that conditional statement is true or false,we then do one thing when the condition is true and something else when the condition is false.
Lets see if we can create a version of the above flowchart in python.