Skip to main content

Featured

Write a Python Program to find palindrome of a given string

If you reverse the word then you get the same word that word is palindrome. def   palindrome ( str ):     pointer =  str       rev_str =  reversed (pointer)       if   list (pointer) ==  list (rev_str):         print ( "It is palindrome" )       else :         print ( "It is not palindrome" )  palindrome( 'level' ) palindrome( 'madam' ) palindrome( 'life' ) palindrome( 'refer' ) Output:  It is palindrome It is palindrome It is not palindrome It is palindrome

Operators-Arithmatic

 

Operators:

                In this post we are going to learn about operators, we use operators in order to manage types of operations and in this we are going to talk about the difference and application


Types of operators:

       1. Arithmetic operator

        2. Assignment operator

        3. Comparison operator

        4. Logical operator

        5. Membership operator

        6. Bit wise operator


1. Arithmetic operator

     The simplest operator are arithmetic operator you probably already know them from mathematics

          

ARITHMETIC OPERATORS


       + Addition Adds two values

        - Subtraction Subtracts one value from another

        * Multiplication Multiplies two values

        / Division Divides one value by another

       % Modulus Returns the remainder of a division

       ** Exponent Takes a value to the power of another value

       // Floor Division Returns the result of a division without decimal places


Example:

    20 + 10 = 30 

    20 - 10 = 10

    2 * 10 = 20 

    5 / 2 = 2.5

    5 % 2 = 1 

    5 ** 2 = 25

    5 // 2 = 2

you can also use variables and not only pure values.


Output:

-Arithmatic Operators


In next post lets see about assignment operator 



Comments

Post a Comment

Popular Posts