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*

6
  • \$\begingroup\$ Instead of using global f in h(z), use def h(z,f) and pass the global f in when calling it. In fact, you don't need h(z) at all - just put the body where you call it. You don't need r=2, and you can just do print(r) without the if, since you need to output a falsey value for false queries. You can rename syn to z and shave off several bytes there. I don't think you need the [] around your list comprehension in the first any. \$\endgroup\$ Commented Oct 18, 2015 at 23:37
  • \$\begingroup\$ You also use e once, so you can do away with the definition and just use [a,b,c,d]. Instead of if s(i,g) is not None, do if s(i,g) - re.Match objects are always evaluated to True if a match is found. You can also drop 2 bytes with f[x]+=f[y]. \$\endgroup\$ Commented Oct 18, 2015 at 23:42
  • \$\begingroup\$ @Mego Wow, thanks for all the tips. I'll need to put them in later. \$\endgroup\$ Commented Oct 19, 2015 at 0:36
  • \$\begingroup\$ This post will probably help you out a lot \$\endgroup\$ Commented Oct 19, 2015 at 0:43
  • \$\begingroup\$ @Mego Big thanks, its down to 396 now. I will post is shortly. \$\endgroup\$ Commented Oct 19, 2015 at 1:20