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

m (→‎OEIS references: added a comment.)
 
(3 intermediate revisions by 2 users not shown)
Line 21:
 
(or something like that).   I'm sure someone will come up with a better, and hopefully, a shorter name.   Of course, it would be better if there was a snappy name for the series, but there ya have it.   At least, the task now has a requirement;   compute and show the results.     -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 06:54, 6 April 2021 (UTC)
 
== Python 'one-liner' added before earlier submissions ==
 
The new 'one-liner' Python variant is very welcome.
 
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.
 
You could either add your code to the end of one of the existing Python sections,
or move your new section to the end.
 
You may also find it helpful to make use of a standard linter.
 
'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.
 
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