Python Revision Tour - Introduction
Python Revision Tour - Introduction
Python Revision Tour - Introduction
introduction
Tokens in Python
1. Keywords
example: False, None, True, and, as, break, elif, if, etc.
2. Identifiers
3. Literals/values
String literals:
Numeric literals:
Integer/ int
hexadecimal form: beginning with 0x, 19, AF, eg, 079, 0xAF
Float
Boolean literals
4. Operators
5. Punctuators
import math
math.<function name>
(OR)
from math import *
Description
Function
Returns the natural logarithm of the absolute value of the Gamma function
lgamma(x)
at x
Random module
import random
random.<function name>
(OR)
from random import *
Code Notes
Functions
Untitled
Type Conversion
a=3 ; b=5.0
>>>int(b)
>>>b=5
Python automatically converts one data type to another data type. This
process doesn't need any user involvement
for example,
a=3 ; b=5.0
>>>c=a+b
>>>c=8.0 (float)
Looping Statements
skips the rest of the loop and jumps over to the statement following the
loop.
the continue statement forces the next iteration of the loop to take place,
skipping any code between