def gcg(seq):
 try:
  seq = str(seq)
 except AttributeError:
  pass
 index = checksum = 0
 for char in seq:
  index += 1
  checksum += (index * ord(char.upper()))
  if (index == 57):
   index = 0
 return (checksum % 10000)

def gcg ( seq ) : try : seq = str ( seq ) except AttributeError : pass index = checksum = 0 for char in seq : index += 1 checksum += ( index * ord ( char . upper ( ) ) ) if ( index == 57 ) : index = 0 return ( checksum % 10000 )
returns the gcg checksum for a sequence .