Saturday, February 17, 2018

Variables Declarations & Arithmetic Operators

  • Variables names can contain only letters, numbers and underscores.
  • They can start with a letter or an underscore
  • Underscore can be used to separated words
  • Python keywords should be avoid
  • Variables names should be short/descriptive
  • Variables can't start with numbers
  • Spaces are not allowed in variables names

Python has five standard data types:
  • Numbers (int, long, float, complex)
  • String
  • List (series of values in a particular order)
  • Tuple (group of fixed values  in size)
  • Dictionary (allows you to connect pieces of info)

Variable Declaration:
Type Format
int myInt = 5
long myLong = 10L
float myFloat = 88.10
complex 3.14J

studentId = "55555"
firstName = "Programming"
lastName = "Clue"
firstList = []
secondList = [1,2,3]
thirdList =  [2,4,'programmingClue']

myTuple = ('real madrid', 'fc barcelona', 'arsenal')

myClubs = {'Real Madrid':'Spain', 'Bayer': 'Germany', 'Miami FC':'US' }

Arithmetic Operators
Operator Meaning Type
+ Addition Binary
- Subtraction Binary
* Multiplication Binary
/ Division Binary
% Modulus Binary

No comments:

Post a Comment