Lesson 2: Selection

Description

By: Arianna
Arianna McCoy
Mind Map by Arianna McCoy, updated more than 1 year ago
Arianna McCoy
Created by Arianna McCoy almost 8 years ago
30
1

Resource summary

Lesson 2: Selection
  1. Basic ways of controlling order
    1. Sequence
      1. Selection
        1. Iteration
        2. Boolean operators
          1. ">" greater than
            1. ">=" greater than or equal
              1. "<" less than
                1. "<=" less than or equal
                  1. "=" equal (in Python this is written as "==")
                    1. "<>" not equal (in Python this is written as "!=")
                    2. Boolean expressions
                      1. A boolean expression evaluates to TRUE or FALSE
                        1. Complex Boolean expressions
                          1. Boolean expressions can include AND, OR and NOT
                            1. AND = Returns TRUE if conditions are true
                              1. OR = Returns TRUE if either of the conditions is true
                                1. NOT = A TRUE expression becomes FALSE and vice versa
                            2. Pseudocode
                              1. Pseudocode is a convient way of writing algorithsms without worrying about the syntax of a particular programming language
                                1. Testing an algorithm
                                  1. To make sure your algrotithm works correctly, you should test it with as many sets of test data as needed to make sure it always gives the correct answer
                                  2. Writing pseudocode
                                    1. Practice: Write pseudocode for a program which asks the user to enter the cost of two items, adds the two costs and if the cost is greater than $10.00, displays a message "Sorry, too much". Otherwise it displays the change due fro $10.00
                                  3. Case Statements
                                    1. A CASE statement is useful if there are are more than two alternative paths through the program
                                    2. Plenary
                                      1. IF statements and CASE statements are two different forms of SELECTION statements
                                        1. IF statements can be "nested"
                                          1. Some languages such as Python do not have a CASE statement
                                            1. Pseudocode is a useful tool for developing algorithms before coding them in a programming language
                                              1. You should use test data to test that your programs always produce the expected results
                                              2. Testing an algorithm
                                                1. To make sure your algorithm works correctly, you should test it with as many sets of test data as needed to make sure it always gives the correct answer
                                                  1. Errors often occurs at "boundaries" - eg.a mark of exactly 50 or 70 should be tested
                                                  Show full summary Hide full summary

                                                  Similar

                                                  Computing Hardware - CPU and Memory
                                                  ollietablet123
                                                  SFDC App Builder 2
                                                  Parker Webb-Mitchell
                                                  Data Types
                                                  Jacob Sedore
                                                  Intake7 BIM L1
                                                  Stanley Chia
                                                  Software Processes
                                                  Nurul Aiman Abdu
                                                  Design Patterns
                                                  Erica Solum
                                                  CCNA Answers – CCNA Exam
                                                  Abdul Demir
                                                  Abstraction
                                                  Shannon Anderson-Rush
                                                  Spyware
                                                  Sam2
                                                  HTTPS explained with Carrier Pigeons
                                                  Shannon Anderson-Rush
                                                  Data Analytics
                                                  anelvr