fork download
  1. given_string = "ayznobcyn"
  2. correction_list = [{"wrongs":['x','y','z'],"true":'x'},{"wrongs":['m','n','o'],"true":'m'},{"wrongs":['q','r','s','t'],"true":'q'}]
  3.  
  4. processed_string = ""
  5. true_char = ""
  6.  
  7. for s in given_string:
  8. for correction in correction_list:
  9. true_char=s
  10. if s in correction['wrongs']:
  11. true_char=correction['true']
  12. #print s," is in ",correction['wrongs']
  13. #print "true char is ",true_char
  14. break
  15. #print "tru_char outside ",true_char
  16. processed_string+=true_char
  17.  
  18. print given_string
  19. print processed_string
  20.  
Success #stdin #stdout #stderr 0.03s 42016KB
stdin
Standard input is empty
stdout
ayznobcyn
axxmmbcxm
stderr
Warning: cannot find your CPU L2 cache size in /proc/cpuinfo