Friday, 15 March 2019

fundamental of python class 11 cbse part 1

PYTHON FUNDAMENTALS

CHARACTER SET

  • It is a group of letters and signs which are specific to a language.
  • Set include letter, sign, number, symbols.
  1. Letter:A-Z, a-z.
  2. Digit: 0-9.
  3. special symbols: -,=,*,/,',(,) etc.
  4. White spaces: blank space, tab, carriage, return, newline, formfeed etc.
  5. 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-

  1. keyword
  2. Identifiers
  3. Literals
  4. Operators 
  5. 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. 
               eg. false, class, if, or.

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.

  1.  String literals.
  2. Numeric literals.
  3. Boolean literals.
  4. Special literals.
  5. 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
  1. Single line string: Text ="hello world" or Text = 'hello world'.
  2. 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)
             x= none

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.
             Eg: C=a+b
    Types of operators
  1. Uniary Operators.
  2. 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