Skip to main content
Tidied up code
Source Link
nmpeterson
  • 8.4k
  • 34
  • 60

What you want to do in the codeblock for Python is define a function, and then call the function using your attributes as parameters as follows:

def comparison(left,right):
    output = 0.0
    if left < right:
        output =return left
    else:
        output = right
    return outputright

output = comparison(!MIN_LEFT!,!MIN_RIGHT!)

Then, all you need in the calculation is output, as you already had for VBScript.

What you want to do in the codeblock for Python is define a function, and then call the function using your attributes as parameters as follows:

def comparison(left,right):
    output = 0.0
    if left < right:
        output = left
    else:
        output = right
    return output

output = comparison(!MIN_LEFT!,!MIN_RIGHT!)

Then, all you need in the calculation is output, as you already had for VBScript.

What you want to do in the codeblock for Python is define a function, and then call the function using your attributes as parameters as follows:

def comparison(left,right):
    if left < right:
        return left
    else:
        return right

output = comparison(!MIN_LEFT!,!MIN_RIGHT!)

Then, all you need in the calculation is output, as you already had for VBScript.

Source Link
nmpeterson
  • 8.4k
  • 34
  • 60

What you want to do in the codeblock for Python is define a function, and then call the function using your attributes as parameters as follows:

def comparison(left,right):
    output = 0.0
    if left < right:
        output = left
    else:
        output = right
    return output

output = comparison(!MIN_LEFT!,!MIN_RIGHT!)

Then, all you need in the calculation is output, as you already had for VBScript.