Python Forum

Full Version: returncode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
"""
Create a function called returncode, taking a single integer argument that
would:
  1. Cause the program to exit, setting the return code to the value passed
    as an argument
  2. When inspected, would return the following help string:
    Exits the program with the specified returncode

For example:
  returncode(10) ->
  # Process terminates with return code of 10
"""

import sys
def returncode(b):
    """ Exits the program with the specified returncode"""
    sys.exit(b)
    """sys.exit('# Process terminates with return code of %s'%(b))"""
b = 10
returncode(b)
What is wrong in this...Is there a better way of doing this
(Dec-09-2016, 01:40 AM)roadrage Wrote: [ -> ]What is wrong in this
Why do you believe something is wrong?