def random_upper(t):
 return ''.join(((c.upper() if (random.random() > 0.5) else c) for c in t))

def random_upper ( t ) : return '' . join ( ( ( c . upper ( ) if ( random . random ( ) > 0.5 ) else c ) for c in t ) )
change random chars of the string to upper case .