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.

Required fields*

3
  • \$\begingroup\$ Welcome to Code Golf, and nice first answer! Be sure to check out our Tips for golfing in Python page for ways you can golf your program. I've added a link to Try it online, so that other users can test your program \$\endgroup\$ Commented Aug 3, 2021 at 19:48
  • 4
    \$\begingroup\$ A rather obscure trick: [w]*(d[0]-2) -> -2%d[0]*[w]. \$\endgroup\$ Commented Aug 3, 2021 at 20:57
  • \$\begingroup\$ ah thanks dingledooper. I thought there might be a way I could change the order of operations in order to avoid the parentheses but I couldn't come up with this. \$\endgroup\$ Commented Aug 4, 2021 at 1:11