General Notes

Identifiers and Data Types

Variable

  • Name given to a distinct memory location and contains a value
  • Can be updated throughout the program

Constant

  • Name given to a distinct memory location and contains a value
  • Cannot be updated once it is created
  • Python does not have true constants. Instead, use variables written in all uppercase to show that they should be treated as constants.

Data Types

  • INTEGER: Represents a whole number
  • REAL: Represents a floating point number
  • CHAR: Represents a character, surrounded by single quotes (‘A’)
  • STRING: Sequence of characters, surrounded by “double quotes”
  • BOOLEAN: The logical values True or False
  • ARRAY: A list of same data type
  • FILE: Resource for recording data in a computer
  • NULL: No Value

PYTHON

Python can be executed directly in the browser.

Editor — Python
Output
No output yet.

Identifier

  • Name given to an entity distinctly identifying an entity in a program
  • Variable names, function names, class names all are identifiers
  • It’s a good practice to use PascalCase or camelCase
  • Rules
    • Must be unique
    • Cannot have spaces
    • Must begin with a letter
    • Can consist of letters, digit or underscore
    • Reserved words in the language cannot be used (eg. return, int, float, if)
    • Names are case sensitive