Do:
- 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
Don'ts:
- 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)
Type | Format |
---|---|
int | myInt = 5 |
long | myLong = 10L |
float | myFloat = 88.10 |
complex | 3.14J |
String:
studentId = "55555"
firstName = "Programming"
lastName = "Clue"
List:
firstList = []
secondList = [1,2,3]
thirdList = [2,4,'programmingClue']
Tuples:
myTuple = ('real madrid', 'fc barcelona', 'arsenal')
Dictionary:
myClubs = {'Real Madrid':'Spain', 'Bayer': 'Germany', 'Miami FC':'US' }
firstList = []
secondList = [1,2,3]
thirdList = [2,4,'programmingClue']
Tuples:
myTuple = ('real madrid', 'fc barcelona', 'arsenal')
Dictionary:
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