Category: Software Design & Devlopment

Python – print()

The print() function displays a string to the screen. It can be used like this.

  • print(“hello there”) – displays hello there
  • print(4*4) – displays 16
  • print(“4*4”) – displays 4*4

Note that the last line has quotes around the calculation causing the string to be displayed.

You can use either a single quote ‘ or double quotes ” within the brackets. More on this later.

Python – Input()

Python input() function returns a string to the assigned variable. This can cause us problems when we want to store integers or floats.

We can use the int() function to convert the string to a integer or the float() function to convert it to a floating point. It is better to do this when you get the input or initialise the variable as you may forget later in the program.

InputInt
The first block of code shows Python returning a string. The second block of code uses a int() to return an Integer

 

Low-level operations and computer architecture

  • Units of storage: bit, byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte
  • Translation of high-level program code to binary (machine code): interpreters and compilers
  • Use of binary to represent and store:
    • Integers
    • Real numbers (mantissa & exponent)
    • Characters
    • Instructions (machine code)
    • Graphics (bit-mapped and vector)
  • Basic computer architecture:
    • Processor( registers, ALU, control unit)
    • Memory
    • Buses (data and address)
    • Interfaces

Read more

Computational Constructs

  • Expressions to assign values to variables
  • Expressions to return values using arithmetic operations (+, -, *, /, ^, mod)
  • Execution of lines of code in sequence demonstrating input – process- output
  • Expressions to concatenate strings and arrays using the & operator
  • Use of selection constructs including simple and complex conditional statements and logical operators.
  • Iteration and repetition using fixed and conditional loops Pre-defined functions (with parameters)

Read more