Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 3
    \$\begingroup\$ @petStorm I disagree, "The final output in dog years must be a decimal, rounded to 2 digits." states nothing about necessitating trailing zeros (and that's assuming it means 2dp rather than 2sf). Furthermore, many answers will give no trailing zero, e.g. 0.5 when given 20. \$\endgroup\$ Commented Aug 2, 2020 at 14:52
  • 2
    \$\begingroup\$ lambda n:round(math.exp(-~n/16-2),2) saves 4 \$\endgroup\$ Commented Aug 2, 2020 at 15:24
  • 1
    \$\begingroup\$ If we can't assume n is an integer we can't use ~; if we can assume n is an integer (in \$[1,122]\$) we can do lambda n:round(2.71828**((n-31)/16),2) for 38. \$\endgroup\$ Commented Aug 2, 2020 at 16:36
  • \$\begingroup\$ ...actually, lambda n:round(1.06449445**(n-31),2) would work for 36. \$\endgroup\$ Commented Aug 2, 2020 at 16:48
  • \$\begingroup\$ @JonathanAllan Oh wow, that's great - thanks! :D \$\endgroup\$
    – Noodle9
    Commented Aug 2, 2020 at 17:02