PYTHON FUNDAMENTALS
CHARACTER SET
- It is a group of letters and signs which are specific to a language.
- Set include letter, sign, number, symbols.
- Letter:A-Z, a-z.
- Digit: 0-9.
- special symbols: -,=,*,/,',(,) etc.
- White spaces: blank space, tab, carriage, return, newline, formfeed etc.
- Other character: Python can process all character of ASCII and UNICODE.
TOKENS
- Tokens is the smallest unit of any programming language.It is also known as Lexical unit.
Types of token are-
- keyword
- Identifiers
- Literals
- Operators
- Punctuators
KEYWORDS
- Keywords are those words which provides a specific meaning to interpreter.
- These are reserved for specific functioning.
- These can not be used as identifiers ,variable name or any purpose.
IDENTIFIERS
- Theses are building blocks of a program and are used to give names to different parts/blocks of a program like variable, objects, classes, functions.
- An identifier may be combination of letter and numbers.
- An identifier must begin with an alphabet or an underscore ( _ ). Subsequent letters may be number (0-9).
- Uppercase and lowercase has different meaning.
- Length of an identifier is unlimited.
- Keywords can not used as an identifier.
- Ex. Myfile, Date_9_0_12.
LITERAL / VALUES
- Literal are also called constant values.
- Python permits following types of literals.
- String literals.
- Numeric literals.
- Boolean literals.
- Special literals.
- Literal collection.
String literals
- String literals is sequence of characters that can be a combination of letters, numbers and special symbols, enclosed in quotation mark, single, double, triple. (' '," ","' "').
- Types of string
- Single line string: Text ="hello world" or Text = 'hello world'.
- Multi line string: Text= 'hello/ or Text=
world'
Numeric literals
numeric values can be of 3 types-
INT.
- Decimal int. literal - 10,17,210 etc.
- Octal int. literal - 0o17, 0o217 etc.
- Hexa decimal int.- 0x14 etc.
FLOAT (floating point real value)
- Fraction form - 2.5 , 4534.456+3455.434, etc.
- Exponent form - 1.8E+5. etc.
COMPLEX ( complex numbers)
- 3+5i etc.
BOOLEAN LITERAL
- It can contain either of only 2 values- true or false.
SPECIAL LITERALS
- None, which means nothing(no value)
OPERATORS
- An operator is symbol that trigger some action when applies to identifiers (s)/ operand(s).
- Therefore, an operator requires operand (S) to computer upon.
Types of operators
- Uniary Operators.
- Binary Operators.
PUNCTUATORS
- In Python, punctuator are used to construct the program and make balance between instruction and statements Punctuators have their own synthetic semantic significance.
- EX. /.;'=- etc.
No comments:
Post a Comment