Followers

Latest techys

Part-6 Python Fundamentals | Start from the basics



 If u fell any difficulty in watching the content, try to reduce the size of this page or rotate your portable device if you are using it


In the previous article, we learnt about Numeric Literals. Today, we shall learn about Boolean Literals, Special Literal, Operators & Punctuators. So let's start.


  • Boolean Literals: These literals are used to represent TRUE or FALSE i.e. the Boolean Values.


  • Special Literal: In Python there is a special literal which is called None. It is used to indicate that there is no value inputted i.e. "there is no useful information" or "There's nothing here"

Python doesn't show anything when asked to display the value of a variable which contains the value None whereas if you use the print statement, it will display None as output.




Operators
    
    These are tokens that trigger some computation when applied to variables & other objects in an expression. Variables or objects to which the compouation is applied are called operands.

*Operators requires at least one operand to work upon.


There are two types of operators in Python, they are:

1. Unary operators: These operators work upon only one operand
    
        +    Unary plus                       Unary minus
          Unary complement    not    Logical negation


2. Binary operators: These require two operators to work upon.

        Arithmetic operators
               +     Addition                               
                -    Subtraction
               *     Multiplication                       
                /    Division
               //     Floor division
               %   Remainder/Modulus            
               **   Exponent (raise to power)

        Bitwise operator
                &   Bitwise AND
                ^    Bitwise exclusive OR (XOR)
                |     Bitwise OR

        Shift operator
                <<   Shift left
                >>   Shift right

        Identity operator
                is          is the identity same?
                is not   is the identity not same?

        Relational operator
                <       Less than
                >      Greater than
                <=    Less than or equal to 
                >=    Greater than or equal to
                ==    Equal to
                !=     Not equal to

        Assignment operator
                    Assignment
                /=     Assign quotient
                +=    Assign sum 
                -=     Assign difference
                *=     Assign product
                %=    Assign remainder
                **=    Assign exponent
                //=      Assign floor division

        Logical operator
                and     Logical AND
                or       Logical OR

        Membership operator
                in          whether variable in sequence
                not in    whether variable not in sequence



Punctuators
    Punctuators are the symbols that are used for organizing sentences & indicate the rhythm and emphasis on expressions, statements and program structure.

For example:  '  "  #  \  ( )  { }  [ ]  @  ,  :  .  `  =



We shall learn about the Barebones of a Python program in the next article.





No comments