def attach_ordinal(num):
 suffixes = dict(((str(i), v) for (i, v) in enumerate(['th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'])))
 v = str(num)
 if (v in {'11', '12', '13'}):
  return (v + 'th')
 return (v + suffixes[v[(-1)]])

def attach_ordinal ( num ) : suffixes = dict ( ( ( str ( i ) , v ) for ( i , v ) in enumerate ( [ 'th' , 'st' , 'nd' , 'rd' , 'th' , 'th' , 'th' , 'th' , 'th' , 'th' ] ) ) ) v = str ( num ) if ( v in { '11' , '12' , '13' } ) : return ( v + 'th' ) return ( v + suffixes [ v [ ( - 1 ) ] ] )
helper function to add ordinal string to integers 1 -> 1st 56 -> 56th .