Compare length of two strings: Difference between revisions

Line 367:
lengths and classification as the longest, shortest or average length.
 
Note that for N > 0 such objects (e.g., strings, byte stringsbytes, lists) it is
possible that exactly M > 0 of them will be of the maximum length, K > 0 of
them will be of the minimum length. In particular, it is possible that all
Line 393:
# Longer phrases make translation into other natural languages easier.
#
has_length = _('has length')
if all(isinstance(obj, str) for obj in objects):
predicate_max = _('and is the longest string')
predicate_min = _('and is the shortest string')
predicate_ave = _('and is neither the longest nor the shortest string')
else:
predicate_max = _('and is the longest object')
predicate_min = _('and is the shortest object')
predicate_ave = _('and is neither the longest nor the shortest object')
 
if sorted_:
Line 412 ⟶ 413:
else:
predicate = predicate_ave
print(f'"{obj}", hashas_length, length, {length} and {predicate}')
 
 
Line 428 ⟶ 429:
print()
compare_and_report_length(*LIST)
print()</lang>
</lang>
 
{{out}}