1 / 7

Session Objectives #U2 S3

Session Objectives #U2 S3. Key Words. Flow Chart. IF ELSE. Subroutine. Loop. IF ELSEIF ELSE. Do While. Flow Chart Symbols Revisited. Using white boards display what these symbols mean? 1. 2. 3. 4. 5. START/STOP. Decision (IF or CASE Statements).

tania
Download Presentation

Session Objectives #U2 S3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Session Objectives#U2 S3

  2. Key Words Flow Chart IF ELSE Subroutine Loop IF ELSEIF ELSE Do While

  3. Flow Chart Symbols Revisited Using white boards display what these symbols mean? 1. 2. 3. 4. 5. START/STOP Decision (IF or CASE Statements) Process either arithmetic ‘a + b’ or action ‘open file’ Input or Output Subroutine symbol – a subroutine is like a program within the program. It is used to simplify complex flow charts

  4. Exam Style Questions on Flow Charts Please go to your Hodderebook p.71 and complete Q4. When completed go to your calculator programme flow chart and extend it to include more than one function i.e +, -, * and /.

  5. Flow Chart for 4 Operations Calculator START Which Calculator If = / If = + If = - If = * Input Number 1 Input Number 1 Input Number 1 Input Number 1 Input Number 2 Input Number 2 Input Number 2 Input Number 2 Answer = N1 / N2 Answer = N1 + N2 Answer = N1 * N2 Answer = N1 - N2 Output Answer Output Answer Output Answer Output Answer STOP STOP STOP STOP

  6. Now let’s code the solution You will now need to code the solution using an IF statement To have multiple outcomes you simply use the IF, ELSEIF, ELSE structure IF variable test variable-or-value { // Run code here if test true } ELSEIF var2 test2 var-or-value2 { // Run code here if test2 true } ELSE { // Run code here if both false } // Code here always runs

  7. EXTENSION How could you prevent the user from having to restart the program if they want to perform another calculation? Add this to your flow chart and use the codecademyPythonglossary for the code to do this.

More Related