79329750

Date: 2025-01-04 23:03:44
Score: 4.5
Natty:
Report link

The first question to ask is - do you actually need to optimize the code ?

What problem are you trying to solve ?

  1. Is the code too slow ?
  1. Is the code readable ?

You can spend a lot of time tweaking and changing - but unless you actually have a goal, then you're more likely just going to spend lots of time doing more and more tweaking.

IF I was going to tweak this code - I'd iterate across the true/false list.

for index in len(b):   
  if b[index]:
    a[index] += 1

That way you're only touching list "a" when you need to, rather than every time.

Reasons:
  • RegEx Blacklisted phrase (1.5): solve ?
  • RegEx Blacklisted phrase (2.5): Do you have a
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Chris Higgins