def Resultat(x,y): diff = x-y return '%d:%02d' % divmod(diff, 60) Variation = Resultat( !ScePUPbr! , !SitPUPbr!)
def Resultat(x,y): diff = x-y if diff < 0: sign = '-' else: sign = '' return sign+'%d:%02d' % divmod(abs(diff), 60)
diff = abs(x-y)
Take the absolute value of the difference:diff = abs(x-y)
def Resultat(x,y): diff = x-y if diff < 0: sign = '-' else: sign = '' #These are two single quotes (an empty string) return '%s%d:%02d' % (sign, divmod(diff, 60))
ERROR 000539: Error running expression: Resultat( -2000 , 0) <type 'exceptions.TypeError'>: %d format: a number is required, not tuple
def Resultat(x,y): diff = x-y if diff < 0: sign = '-' else: sign = '' #These are two single quotes (an empty string) return sign + '%d:%02d' % divmod(diff, 60)
def Resultat(x,y): diff = abs(x-y) #abs doesn't make any difference without a positive and negative value if diff < 0: sign = '-' else: sign = '' #These are two single quotes (an empty string) return sign + '%d:%02d' % divmod(diff, 60)
!Variation![0:1] + !testvari!
'-%d:%02d' % divmod(4, 60)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.