<garvit244>8_1.py
def myAtoi( str):
    str = str.strip()
    number = ""
    
    
    for x in str:
        if x.isalpha() and number == "":
            return 0
        elif x.isalpha():
            break
        elif x == ".":
            break
        elif x == " ":
            break
        elif (x == "+" or x == "-") and number == "":
            number = number + x
        elif (x == "+" or x == "-") and number != "":
            break
        elif (x == "+" or x == "-") and (number[-1] == "+" or number[-1] == "-"):
            return 0
        elif (x == "+" or x == "-") and ("+" in number or "-" in number):
            break
        elif x.isdigit():
            number = number + x
    if number == "" or number == "+" or number == "-":
        return 0
    else:
        if int(number) > ((2**31)-1):
            return (2**31)-1
        elif int(number) < -(2**31):
            return -(2**31)
        else:
            return int(number)
def sample_funcname ( var_0 ) :
    var_0 = var_0.strip ( )
    var_3 = ""
    for var_4 in var_0 :
        if var_4.isalpha ( ) and var_3 == "" :
            return 0
        elif var_4.isalpha ( ) :
            break
        elif var_4 == "." :
            break
        elif var_4 == "" :
            break
        elif ( var_4 == "+" or var_4 == "-" ) and var_3 == "" :
            var_3 = var_3 + var_4
        elif ( var_4 == "+" or var_4 == "-" ) and var_3 != "" :
            break
        elif ( var_4 == "+" or var_4 == "-" ) and ( var_3 [ - 1 ] == "+" or var_3 [ - 1 ] == "-" ) :
            return 0
        elif ( var_4 == "+" or var_4 == "-" ) and ( "+" in var_3 or "-" in var_3 ) :
            break
        elif var_4.isdigit ( ) :
            var_3 = var_3 + var_4
    if var_3 == "" or var_3 == "+" or var_3 == "-" :
        return 0
    else :
        if int ( var_3 ) > ( ( 2 ** 31 ) - 1 ) :
            return ( 2 ** 31 ) - 1
        elif int ( var_3 ) < - ( 2 ** 31 ) :
            return - ( 2 ** 31 )
        else :
            return int ( var_3 )
