[Solved] Character Reversal without reversing numbers [closed]


try this

def reverse_besides_number(l):
  # convert number in list to a dict
  # record the index
  d = {k: v for k, v in enumerate(l) if v.isdigit()}
  # record the character in list
  c = [i for i in l if not i.isdigit()]
  c.reverse()
  # insert
  for key, value in d.items():
      c.insert(key, value)
  return c

solved Character Reversal without reversing numbers [closed]