Python Random note

Post by ailswan Oct.10 , 2023

Python debug note

Date: October 10, 2023 Tags: python language

Tricky Python note for debug

# backtracking must use the deep copy:

  res.append(path[:])

# rotated array must use module:

  k %= n  

# create defaultdict:

  dic = defaultdict(list)
  for word in wordList
    for i in range(len(word)):
      dic [word[:i] + "_" word[i + 1:]]. append(word)

pending: implement multiple threads