Online Vs Offline Agents


 

AP เฐธేเฐตా เฐชోเฐฐ్เฐŸเฐฒ్ eServices เฐšెเฐฒ్เฐฒింเฐชు เฐตిเฐงాเฐจం

 


AP เฐธేเฐตా เฐชోเฐฐ్เฐŸเฐฒ్‌เฐฒోเฐจి eServices เฐšెเฐฒ్เฐฒింเฐชుเฐจు เฐช్เฐฐเฐคిเฐฐోเฐœూ เฐคเฐช్เฐชเฐจిเฐธเฐฐిเฐ—ా เฐ•ాเฐฐ్เฐฏాเฐฒเฐฏం เฐตిเฐกిเฐšే เฐฎుంเฐฆు เฐšేเฐฏాเฐฒి.

เฐฒేเฐฆంเฐŸే เฐฐాเฐค్เฐฐి เฐธเฐฎเฐฏంเฐฒో เฐ†เฐŸోเฐฎేเฐŸిเฐ•్‌เฐ—ా เฐšเฐฒాเฐจ్ (Challan) เฐœเฐจเฐฐేเฐŸ్ เฐ…เฐตుเฐคుంเฐฆి.

๐Ÿ‘‰ eServices เฐฎొเฐค్เฐคాเฐจ్เฐจి QR / เฐชేเฐฎెంเฐŸ్ เฐฏాเฐช్เฐธ్ เฐฆ్เฐตాเฐฐా เฐšెเฐฒ్เฐฒింเฐšเฐตเฐš్เฐšు.

๐Ÿ‘‰ เฐ’เฐ•เฐตేเฐณ eServices เฐฎొเฐค్เฐคాเฐจ్เฐจి เฐšెเฐฒ్เฐฒింเฐšเฐกం เฐฎเฐฐిเฐšిเฐชోเฐฏిเฐคే, เฐœเฐจเฐฐేเฐŸ్ เฐ…เฐฏిเฐจ เฐšเฐฒాเฐจ్ เฐฎొเฐค్เฐคాเฐจ్เฐจి เฐคเฐช్เฐชเฐจిเฐธเฐฐిเฐ—ా เฐšెเฐฒ్เฐฒింเฐšాเฐฒి.

๐Ÿ‘‰ เฐœเฐจเฐฐేเฐŸ్ เฐ…เฐฏిเฐจ เฐšเฐฒాเฐจ్ เฐฎొเฐค్เฐคాเฐจ్เฐจి

เฐจెเฐŸ్ เฐฌ్เฐฏాంเฐ•ింเฐ—్ (SBI Quick Transfer) / GPay เฐฏాเฐช్ เฐฆ్เฐตాเฐฐా เฐšెเฐฒ్เฐฒింเฐšเฐตเฐš్เฐšు.

GPay เฐฏాเฐช్ เฐฆ్เฐตాเฐฐా เฐšెเฐฒ్เฐฒింเฐšే เฐตిเฐงాเฐจం:

GPay เฐฏాเฐช్ เฐ“เฐชెเฐจ్ เฐšేเฐฏంเฐกి

Bank Transfer เฐ†เฐช్เฐทเฐจ్‌เฐ•ు เฐตెเฐณ్เฐฒంเฐกి

To Others เฐ†เฐช్เฐทเฐจ్‌เฐจు เฐธెเฐฒెเฐ•్เฐŸ్ เฐšేเฐฏంเฐกి

Receiver’s Bank Details:

เฐฌ్เฐฏాంเฐ•్ เฐ…เฐ•ౌంเฐŸ్ เฐจంเฐฌเฐฐ్: GVVS55EC214AABB4F26B

IFSC เฐ•ోเฐก్: ICIC0000104 (CMS, Mumbai เฐ…เฐจి เฐšూเฐชిเฐธ్เฐคుంเฐฆి)

Continue เฐชై เฐ•్เฐฒిเฐ•్ เฐšేเฐฏంเฐกి

เฐฎเฐณ్เฐฒీ เฐฌ్เฐฏాంเฐ•్ เฐ…เฐ•ౌంเฐŸ్ เฐจంเฐฌเฐฐ్ เฐŽంเฐŸเฐฐ్ เฐšేเฐฏంเฐกి:

GVVS55EC214AABB4F26B

Receiver’s Name:

Commissioner GSWS

Confirm เฐชై เฐ•్เฐฒిเฐ•్ เฐšేเฐฏంเฐกి

Challan amount เฐŽంเฐŸเฐฐ్ เฐšేเฐฏంเฐกి

เฐฎీ PIN เฐŽంเฐŸเฐฐ్ เฐšేเฐธ్เฐคే เฐšెเฐฒ్เฐฒింเฐชు เฐตిเฐœเฐฏเฐตంเฐคంเฐ—ా เฐชూเฐฐ్เฐคเฐตుเฐคుంเฐฆి

เฐจా เฐธంเฐฆేเฐถాเฐจ్เฐจి เฐšూเฐธిเฐจంเฐฆుเฐ•ు เฐงเฐจ్เฐฏเฐตాเฐฆాเฐฒు. ๐Ÿ™

Assert Statements in Python

 1. Simple Version:

assert conditional_expression

2. Augmented Version:

assert conditional_expression, message

conditional_expression will be evaluated and if it is true then the program will be continued.

If it is false then the program will be terminated by raising AssertionError.

By seeing AssertionError, programmer can analyze the code and can fix the problem.

Example

def squareIt(x):

   return x * x

assert squareIt(2) == 4, "The square of 2 should be 4"

assert squareIt(3) == 9, "The square of 3 should be 9"

assert squareIt(4) == 16, "The square of 4 should be 16"

print(squareIt(2))

print(Square(3))

print(squareIt(4))


D:\Python3>py test.py

Traceback (most recent call last):

File "test.py", line 4, in <module>

assert squareIt(3) == 9, "The square of 3 should be 9"

AssertionError: The square of 3 should be 9


def squareIt(x):

    return x * x

 assert squareIt(2) == 4, "The square of 2 should be 4"

assert squareIt(3) == 9, "The square of 3 should be 9"

assert squareIt(4) == 16, "The square of 4 should be 16"

print(squareIt(2))

print(squareIt(3))

print(squareIt(4))


Output

 4

9

16


Exception Handling vs Assertions:

Assertions concept can be used to alert programmer to resolve development time errors.

Exception Handling can be used to handle runtime errors.

Debugging Python Program by using assert keyword:

The process of identifying and fixing the bug is called debugging.

Very common way of debugging is to use print() statement. But the problem with the print() statement is, after fixing the bug, compulsorily we have to delete the extra added print() statements, otherwise these will be executed at runtime which creates performance problems and disturbs console output.

To overcome this problem we should go for assert statement. The main advantage of assert statement over print() statement is, after fixing bug we are not required to delete assert statements. Based on our requirement we can enable or disable assert statements.

Hence the main purpose of assertions is to perform debugging. Usually we can perform debugging either in development or in test environments but not in production environment. Hence assertions concept is applicable only for dev and test environments but not for production environment.

Types of assert statements:

There are 2 types of assert statements

Simple Version

Augmented Version

all messages will be written to log file

 In the above program only WARNING and higher level messages will be written to log file.

If we set level as DEBUG then all messages will be written to log file.

Copy code

Python

1) import logging

2) logging.basicConfig(filename='log.txt', level=logging.DEBUG)

3) print("Logging Module Demo")

4) logging.debug("This is debug message")

5) logging.info("This is info message")

6) logging.warning("This is warning message")

7) logging.error("This is error message")

8) logging.critical("This is critical message")

log.txt:

Copy code


1) DEBUG:root:This is debug message

2) INFO:root:This is info message

How to implement logging in Python

To perform logging, first we are required to create a file to store messages and we have to specify which level messages we have to store.

We can do this by using basicConfig() function of logging module.

Copy code

Python

logging.basicConfig(filename='log.txt', level=logging.WARNING)


The above line will create a file log.txt and we can store either WARNING level or higher level messages to that file.

After creating log file, we can write messages to that file by using the following methods.

Copy code

Python

logging.debug(message)

logging.info(message)

logging.warning(message)

logging.error(message)

logging.critical(message)

Q. Write a Python program to create a log file and write WARNING and higher level messages?

Copy code

Python

1) import logging

2) logging.basicConfig(filename='log.txt', level=logging.WARNING)

3) print("Logging Module Demo")

4) logging.debug("This is debug message")

5) logging.info("This is info message")

6) logging.warning("This is warning message")

7) logging.error("This is error message")

8) logging.critical("This is critical message")

log.txt:

Copy code


1) WARNING:root:This is warning message

2) ERROR:root:This is error message

3) CRITICAL:root:This is critical message

PYTHON LOGGING

Logging the Exceptions:

It is highly recommended to store complete application flow and exceptions information to a file.

This process is called logging.

The main advantages of logging are:

We can use log files while performing debugging.

We can provide statistics like number of requests per day, etc.

To implement logging, Python provides one inbuilt module called logging.

Logging Levels:

Depending on the type of information, logging data is divided according to the following 6 levels in Python.

CRITICAL ==> 50

Represents a very serious problem that needs high attention.

ERROR ==> 40

Represents a serious error.

WARNING ==> 30

Represents a warning message, some caution needed.

It is an alert to the programmer.

INFO ==> 20

Represents a message with some important information.

DEBUG ==> 10

Represents a message with debugging information.

NOTSET ==> 0

Represents that the level is not set.

Types of Exceptions in Python

 -->In Python, there are Two types of exceptions:

1.Predefined Exceptions

2.User Defined Exceptions


1. Predefined Exceptions:

-->Also known as in-built exceptions.

The exceptions which are raised automatically by the Python Virtual Machine whenever a particular event occurs are called predefined exceptions.


Example 1:

Whenever we try to perform division by zero, Python raises ZeroDivisionError.


print(10/0)


Example 2:

Whenever we try to convert input value to int type and the input is not an integer, Python raises ValueError.


x = int("ten")   # ValueError


2. User Defined Exceptions:

-->Also known as Customized Exceptions or Programmatic Exceptions.

-->Sometimes we must define and raise exceptions explicitly to indicate that something has gone wrong. Such exceptions are called User Defined Exceptions or Customized Exceptions.


-->The programmer is responsible for defining these exceptions. Python does not know about them, so we must raise them explicitly based on our requirement by using the raise keyword.


Eg:

InsufficientFundsException  

InvalidInputException  

TooYoungException  

TooOldException


-->How to Define and Raise Customized Exceptions:

-->Every exception in Python is a class that extends the Exception class either directly or indirectly.


Syntax:

class classname(predefined exception class name):

    def __init__(self, arg):

        self.msg = arg


Example:

class TooYoungException(Exception):

    def __init__(self, arg):

        self.msg = arg

-->TooYoungException is our class name which is the child class of Exception.

-->We can raise an exception by using the 

raise keyword as follows:

raise TooYoungException("message")


Complete Example:

class TooYoungException(Exception):

    def __init__(self, arg):

        self.msg = arg


class TooOldException(Exception):

    def __init__(self, arg):

        self.msg = arg


age = int(input("Enter Age: "))


if age > 60:

    raise TooYoungException("Plz wait some more time you will get best match soon!!!")

elif age < 18:

    raise TooOldException("Your age already crossed marriage age... no chance of getting marriage")

else:

    print("You will get match details soon by email!!!")


Output:

Enter Age: 12

__main__.TooYoungException: Plz wait some more time you will get best match soon!!!

Copy code


Enter Age: 90

__main__.TooOldException: Your age already crossed marriage age... no chance of getting marriage


Enter Age: 27

You will get match details soon by email!!!


✅Note:๐Ÿ‘‰ raise keyword is best suitable for customized exceptions, but not for predefined exceptions.

Control flow in try–except–finally Python

try:

    stmt-1

    stmt-2

    stmt-3

except:

    stmt-4

finally:

    stmt-5

    stmt-6


Case-1: If there is no exception

1, 2, 3, 5, 6 → Normal Termination


Case-2: If an exception is raised at stmt-2 and the corresponding except block is matched

1, 4, 5, 6 → Normal Termination


Case-3: If an exception is raised at stmt-2 but the corresponding except block is not matched

1, 5 → Abnormal Termination


Case-4: If an exception is raised at stmt-4, then it is always abnormal termination, but before that the finally block will be executed.


Case-5: If an exception is raised at stmt-5 or at stmt-6, then it is always abnormal termination.


Nested try–except–finally blocks:

We can take try–except–finally blocks inside try or except or finally blocks, i.e., nesting of try–except–finally is possible.


try:

    --------

    --------

    --------

    try:

        --------------

        --------------

        --------------

    except:

        --------------

        --------------

        --------------

    --------------

except:

    ----------

    ----------

    ----------

General Rule:


General risky code we have to take inside the outer try block and too much risky code we have to take inside the inner try block.

Inside the inner try block, if an exception is raised, then the inner except block will handle it.


Except block is responsible to handle.

If it is unable to handle, then outer except block is responsible to handle.

Eg:


try:

    print("outer try block")

    try:

        print("Inner try block")

        print(10/0)

    except ZeroDivisionError:

        print("Inner except block")

    finally:

        print("Inner finally block")

except:

    print("outer except block")

finally:

    print("outer finally block")


Output

outer try block

Inner try block

Inner except block

Inner finally block

outer finally block


Different Cases in try,except and finally blocks in Python

Case-1: If there is no exception

1) try:

2)     print("try")

3) except:

4)     print("except")

5) finally:

6)     print("finally")


Output

try

finally


Case-2: If there is an exception raised but handled


1) try:

2)     print("try")

3)     print(10/0)

4) except ZeroDivisionError:

5)     print("except")

6) finally:

7)     print("finally")


Output

try

except

finally


Case–3: If there is an exception raised but not handled:

1) try:

2)     print("try")

3)     print(10/0)

4) except NameError:

5)     print("except")

6) finally:

7)     print("finally")


Output:o

try

finally

ZeroDivisionError: division by zero (Abnormal Termination)


✅Note:There is only one situation where the finally block won’t be executed, i.e., whenever we are using the os._exit(0) function.


==>Whenever we use the os._exit(0) function, the Python Virtual Machine itself is shut down.

==>In this particular case, the finally block won’t be executed.


1) import os

2) try:

3)     print("try")

4)     os._exit(0)

5) except NameError:

6)     print("except")

7) finally:

8)     print("finally")


Output:

try

✅Note:os._exit(0)

0 represents the status code

It indicates normal termination

Multiple status codes are possible.

Default except block in Python

-->We can use default except block to handle any type of exceptions.

-->In default except block generally we can print normal error messages.


Syntax:


except:

    statements

Example:


try:

    x = int(input("Enter First Number: "))

    y = int(input("Enter Second Number: "))

    print(x / y)

except ZeroDivisionError:

    print("ZeroDivisionError: Can't divide with zero")

except:

    print("Default Except: Plz provide valid input only")



D:\Python3>py Default.py

Enter First Number: 10

Enter Second Number: 0

ZeroDivisionError: Can't divide with zero


D:\Python3>py Default.py

Enter First Number: 10

Enter Second Number: ten

Default Except: Plz provide valid input only


✅Note:

If try has multiple except blocks, then the default except block should be last.

Otherwise, we will get a SyntaxError.

Example (Wrong Order):


try:

    print(10/0)

except:

    print("Default Except")

except ZeroDivisionError:

    print("ZeroDivisionError")



SyntaxError: default 'except:' must be last

✅Note:

The following are various possible combinations of except blocks:

except ZeroDivisionError:

except ZeroDivisionError as msg:

except (ZeroDivisionError, ValueError):

except (ZeroDivisionError, ValueError) as msg:

except:


finally block:


-->It is not recommended to maintain clean up code (Resource Deallocating Code or Resource Releasing code) inside try block because there is no guarantee for the execution of every statement inside try block always.

-->It is not recommended to maintain clean up code inside except block, because if there is no exception then except block won’t be executed.

Hence we required some place to maintain clean up code which should be executed always irrespective of whether exception raised or not raised and whether exception handled or not handled. Such type of best place is nothing but finally block.

Hence the main purpose of finally block is to maintain clean up code.


try:

    Risky Code

except:

    Handling Code

finally:

    Cleanup code


-->The speciality of finally block is it will be executed always whether exception 

raised or not raised and whether exception handled or not handled.