Skip to main content
added 143 characters in body
Source Link
FelixIP
  • 23.3k
  • 3
  • 31
  • 62

Best go is use of dictionary:

def getDivider(A,B):
    aDict={'RS6':6000,'SP':2000}
    if A in aDict:  return B/aDict[A]*0.8
    return -1

======================================

getDivider(!ZONING!,!SQFeet_1!)

Update following @Paul suggestion:

def getDivider(A,B):
  aDict={'RS6':6000,'SP':2000}
  return B/aDict.get(A,0)*0.8

Best go is use of dictionary:

def getDivider(A,B):
  aDict={'RS6':6000,'SP':2000}
  if A in aDict:  return B/aDict[A]*0.8
  return -1

======================================

getDivider(!ZONING!,!SQFeet_1!)

Best go is use of dictionary:

def getDivider(A,B):
    aDict={'RS6':6000,'SP':2000}
    if A in aDict:  return B/aDict[A]*0.8
    return -1

======================================

getDivider(!ZONING!,!SQFeet_1!)

Update following @Paul suggestion:

def getDivider(A,B):
  aDict={'RS6':6000,'SP':2000}
  return B/aDict.get(A,0)*0.8
Source Link
FelixIP
  • 23.3k
  • 3
  • 31
  • 62

Best go is use of dictionary:

def getDivider(A,B):
  aDict={'RS6':6000,'SP':2000}
  if A in aDict:  return B/aDict[A]*0.8
  return -1

======================================

getDivider(!ZONING!,!SQFeet_1!)