Saturday, 5 June 2021

CLASS 11 CS CHAPTER 2

 

CLASS -11  COMPUTER SCIENCE

          CHAPTER-2 PYTHON FUNDAMENTALS


🔔To download textbook pdf click on the ''DOWNLOAD'' button below -




NOTES FOR COMPLETE UNDERSTANDING -


  •  Program, is a group of instructions that controls processing.

  •  Or we can say , base for processing is ‘the Program’.

  • Elements of processing i.e.– character sets , token, statements, input , expressions .

  • Character Set - is a group of letters or signs which are specific to a language.

  •  Character set contains alphabets , signs, numbers , symbols . 
  1. Letters: A-Z, a-z   
  2. Digits: 0-9   
  3. Special Symbols: _, +, -, *, /, (, ), {, } . . . etc.     
  4. Spaces: blank space, carriage return, newline, form feed , tab ,etc.     
  5. It can process all characters of ASCII & UNICODE. 

  • Token-
  • It is the smallest unit of any programming language and also known as Lexical Unit. 

  • Various types of token are-
  1. Keywords 
  2. Identifiers
  3. Literals 
  4. Operators 
  5. Punctuators

  • Keywords are those which provides a special meaning to interpreter and are reserved for specific functioning in coding .

  • Keywords can't be used as an identifier , variable name or for any other purpose. 

  • Available keywords in Python are -
  1. False ,
  2. assert,
  3. del , 
  4. for , 
  5. in ,
  6. or ,
  7. while ,
  8. break ,
  9. elif , 
  10. from ,
  11. is ,
  12. pass ,
  13. with ,
  14. True ,
  15. else ,
  16. global ,
  17. lambda ,
  18. raise ,
  19. yield ,
  20. and ,
  21. except ,
  22. if ,
  23. nonlocal ,
  24. as ,
  25. import ,
  26. not ,
  27. try, 
  28. class ,
  29. def ,
  30. finally ,
  31. is ,
  32. return ,
  33. None ,
  34. continue .

  • Identifiers - Identifiers can be considered as building blocks for a program as they are used to locate names to different parts of a program like : variables , objects , class , etc.

  • It can be a mixtures of letters & numbers.

  •  It must begin with an alphabet or an underscore( _ ). 
  • Subsequent letters may be numbers(0-9). 

  • Python is case sensitive i.e. the uppercase letters are different from that of  lowercase letters (T and t are different for interpreter).

  • Length of an Identifier is unlimited.

  • Keywords can't allowed to be used as an identifier.

  • Space and special symbols should not be there in an identifier name excluding underscore( _ ) sign.

  • Literals are often called Constant Values.

  • Python permits following types of literals -                                                                       – String literals - “Pankaj” ,  – Numeric literals – 10, 13.5, 3+5i , – Boolean literals – True or False , – Special Literal None , -Literal collections

  • String Literal is a sequence of  combination of letters, numbers and special symbols , enclosed within single , double or triple quotes .
  • In python, string is of 2 types-    – Single line string :Text = “Hello World” or Text = ‘Hello World’      – Multi line string :Text = ‘hello\n world’ or Text = ‘’’hello  word ’’  

  • Numeric values can be of 3 variants -                                                                                                  
  • int (signed integers)
  1. Decimal Integer Literals – 11, 137, 2770 etc. 
  2. Octal Integer Literals - 0o17, 0o217 etc. 
  3. Hexadecimal Integer Literals – 0x15, 0x2A3, 0xABC etc.                                                                                                                                   
  • float ( floating point real value) 
  1. Fractional Form – 2.07 , 17.555  -13.5,   -0.00015 etc. 
  2. Exponent Form - -1.7E+8, .25E-4 etc.                                                                            
  • Complex (complex numbers) : 3+5i etc.

  • Boolean Literals 
  • It can have either of only two values – True or False 

  • Special Literals
  • Special literal is None, which means nothing (no value): X = None

  • Operators
  • An Operator can be considered as a representation of some action that has to be applied on  identifier (s)/ operand (s).

  •  Concluding that an operator requires operand (s) to compute upon. example : c = a + b Here, a, b, c are operands and operators are = and + which are performing differently

  • Types of Operator-   Python supports following types of operators.

  • Unary operators:
  • Unary plus (+) 
  • Unary Minus (-)  
  • Binary Operator 
  • Arithmetic operator (+, -, *, /, %, **, //) 
  • Relational Operator(<, >, <=, >=, ==, != ) 
  • Logical Operator (and, or) 
  • Assigment Operator (=, /=, +=, -=, *=, %=, **=, //=) 
  • Bitwise Operator (& bitwise and, ^ bitwise xor, | bitwise or) 
  • Shift operator (<< shift left, >> shift right) 
  • Identity Operator (is, is not) 
  • Membership Operator (in, not in)
  • Punctuators 

  •  Punctuators are used to build program & to make balance between instructions and statements .They have their own style of syntactic and semantic recognition. 

  •  Python has following Punctuators - ‘ , ” , #, \, (, ), [, ], {, }, @. ,, :, .. `, =

  • As we have seen in previous slides, a program contains following components-      – Expressions like a+b, a>b etc.                                                                                    – Statements like a=10, c=a+b etc.                                                                                  – Comments, lines starting with #.                                                                                  – Function, block starting with def keyword                                                                – Blocks and indentation like if and else blocks   



               🔔MORE MATERIALS TO BE UPLOADED STAY TUNED🔔


WHY Software Developer ?