Talk:Show the (decimal) value of a number of 1s appended with a 3, then squared: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 28:
Normal Rosetta practice is, however, to preserve submission order –
always adding new variants '''after''' existing ones, rather than
 
attempting to rank or prioritise – readers can be allowed to judge for themselves
which version best matches their own interests and contexts.
Line 38 ⟶ 39:
'One-liner' is an understandably seductive phrase,
but the actual value of squeezing code onto one line is uncertain –
 
it's cognitive cost (reduced legibility, except in the very shortest cases) is, however, clearer. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 22:16, 4 October 2021 (UTC)
 
Your first draft exceeds the usual Rosetta limit of 80 chars (also preferred by pyLint etc),
 
and might be more legible if rearranged into two or three lines. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 22:49, 4 October 2021 (UTC)
 
Perhaps, for example, using the slightly cleaner literal string interpolation idiom, as something like:
<lang python>[
print(f'{"1" * i}3^2 = {int("1" * i + "3") ** 2}')
for i in range(0, 8)
]</lang>
 
[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 23:08, 4 October 2021 (UTC)
9,655

edits