Variables - BenWare-FED/Python GitHub Wiki

Variables: A data storage contains with a label(Identifier) attached. All variables have an identifier, data(value), and a type of data. Python autoassigns type of data.

Identifier(Label)(keywords): Name given to the variable.

Identifier rules:

  1. Python is case sensitive. ex pi Pi and PI are all different
  2. You can start the identifier with a letter or an underscore but never with a number.
  3. Identifiers cannot contain special characters other than underscore.
  4. There are predefined identifiers known as key words, don't use them as identifiers ex: print, if, for, while, else, True, False.
  5. Identifiers can be as long as you want as long as you follow da rulez.

Data Types:

  1. To store numerical values

A. Integer: Whole numbers

B. Float: p/q when q doesn't equal zero. Whole number plus a decimal.

  1. To store categorical values

A. Strings: Stores characters. stored within " " ex "strings" "l" "3894573289hfiusdrhi,./?":)(*&^%"

B. Boolean: True, False

Styles

Camal case: areaOfCircle

Pascal case: AreaOfCircle

Snake case: area_of_circle