Programming with Pseudocode and Python

Programming with Pseudocode and Python

Teach yourself Programming with pseudocode and Python for AQA GCSE Computer Science (8520) Students Workbook By Nichola Lacey Contents Introduction ............................................................................................................................................ 5 How to use this book .......................................................................................................................... 5 Who should use this book? ................................................................................................................. 5 Installing Python ................................................................................................................................. 5 Data types ............................................................................................................................................... 6 Using data types .................................................................................................................................. 7 Integer ............................................................................................................................................. 7 Real.................................................................................................................................................. 7 Boolean ........................................................................................................................................... 8 Character ......................................................................................................................................... 8 String ............................................................................................................................................... 8 End of chapter recap ......................................................................................................................... 11 Programming Concepts ......................................................................................................................... 12 Variables ........................................................................................................................................... 12 Constants .......................................................................................................................................... 13 Defining variables and constants ...................................................................................................... 14 Rules of naming variables and constants ...................................................................................... 14 Assignment........................................................................................................................................ 15 Iteration ............................................................................................................................................ 17 Condition-controlled iteration ...................................................................................................... 17 Count-controlled iteration ............................................................................................................ 19 Indenting lines of code .................................................................................................................. 19 Selection ............................................................................................................................................ 21 Nested selection and nested iteration .............................................................................................. 23 Nested iteration ............................................................................................................................ 24 Nested selection ........................................................................................................................... 25 Subroutines (procedures and functions) .......................................................................................... 30 Teach yourself programming with pseudocode and Python for AQA GCSE Computer Science by Nichola Lacey Page 1 Advantages of using subroutines in programs.............................................................................. 31 Passing data within programs ....................................................................................................... 32 Returning single vales ................................................................................................................... 32 Returning multiple values ............................................................................................................. 33 Global and local variables ............................................................................................................. 34 Why use local variables? ............................................................................................................... 34 Functions and Procedures............................................................................................................. 35 End of chapter recap ......................................................................................................................... 40 Operators .............................................................................................................................................. 41 Arithmetic operations in a programming language .......................................................................... 41 Relational operators in a programming language ............................................................................ 43 Boolean operations in a programming language .............................................................................. 45 Using operators in iteration and selection structures ...................................................................... 46 End of chapter recap ......................................................................................................................... 48 Data Structures ..................................................................................................................................... 49 Arrays ................................................................................................................................................ 49 One-dimensional arrays ................................................................................................................ 49 Creating and using a 1D array ....................................................................................................... 50 Two-dimensional arrays ................................................................................................................ 53 Creating and using a 2D array ....................................................................................................... 54 Complex data types .......................................................................................................................... 56 End of chapter recap ......................................................................................................................... 58 Input/Output and file handling ............................................................................................................. 59 User input from the keyboard .......................................................................................................... 59 Displaying output .............................................................................................................................. 59 Reading from and writing to a text file ................................................................................................. 60 File location ................................................................................................................................... 60 Writing to a text file ...................................................................................................................... 60 Teach yourself programming with pseudocode and Python for AQA GCSE Computer Science by Nichola Lacey Page 2 Reading from a text file ................................................................................................................. 63 End of chapter review ....................................................................................................................... 64 String handling operations .................................................................................................................... 65 Length ............................................................................................................................................... 65 Position ............................................................................................................................................. 65 Substring ........................................................................................................................................... 66 Concatenation ................................................................................................................................... 67 Character codes ................................................................................................................................ 67 String conversions ............................................................................................................................. 68 Converting string

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    116 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us