"""A module to demonstrate exceptions."""

import sys


def convert(item):
    '''
    Convert to an integer.
    Args:
        item: some object

    Returns:
        an integer representation of the object

    Throws:
        a ValueException
    '''
    try:
        x = int(item)
        print(str.format('Conversion succeeded! x= {}', x))
    except ValueError:
        print('Conversion Failed')
        x = -1
    return x

if __name__ == '__main__':
    print(convert(sys.argv[1]))
"""A module to demonstrate exceptions."""

import sys


def convert(item):
    """
    Convert to an integer.
    Args:
        item: some object

    Returns:
        an integer representation of the object

    Throws:
        a ValueException
    """
    try:
        return int(item)
    except (ValueError, TypeError):
        return -1

if __name__ == '__main__':
    print(convert(sys.argv[1]))
Use two return statements and remove printing
Use two return statements and remove printing

  """A module to demonstrate exceptions."""
  
  import sys
  
  
  def convert(item):
-     '''
+     """
      Convert to an integer.
      Args:
          item: some object
  
      Returns:
          an integer representation of the object
  
      Throws:
          a ValueException
-     '''
+     """
      try:
-         x = int(item)
+         return int(item)
-         print(str.format('Conversion succeeded! x= {}', x))
-     except ValueError:
+     except (ValueError, TypeError):
-         print('Conversion Failed')
-         x = -1
-     return x
+         return -1
  
  if __name__ == '__main__':
      print(convert(sys.argv[1]))
Use two return statements and remove printing
## Code Before:
"""A module to demonstrate exceptions."""

import sys


def convert(item):
    '''
    Convert to an integer.
    Args:
        item: some object

    Returns:
        an integer representation of the object

    Throws:
        a ValueException
    '''
    try:
        x = int(item)
        print(str.format('Conversion succeeded! x= {}', x))
    except ValueError:
        print('Conversion Failed')
        x = -1
    return x

if __name__ == '__main__':
    print(convert(sys.argv[1]))
## Instruction:
Use two return statements and remove printing
## Code After:
"""A module to demonstrate exceptions."""

import sys


def convert(item):
    """
    Convert to an integer.
    Args:
        item: some object

    Returns:
        an integer representation of the object

    Throws:
        a ValueException
    """
    try:
        return int(item)
    except (ValueError, TypeError):
        return -1

if __name__ == '__main__':
    print(convert(sys.argv[1]))