Quickest way to enumerate the alphabet

(Assumes ASCII, etc) for (char c=”A”; c <= ‘Z’; c++) { //do something with letter } Alternatively, you could split it out to a provider and use an iterator (if you’re planning on supporting internationalisation): public class EnglishAlphabetProvider : IAlphabetProvider { public IEnumerable<char> GetAlphabet() { for (char c=”A”; c <= ‘Z’; c++) { yield return … Read more

Alphabet range in Python

>>> import string >>> string.ascii_lowercase ‘abcdefghijklmnopqrstuvwxyz’ If you really need a list: >>> list(string.ascii_lowercase) [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’] And to do it with range >>> list(map(chr, range(97, 123))) #or list(map(chr, range(ord(‘a’), ord(‘z’)+1))) [‘a’, … Read more