Spy Life Code Coach (Swift) - Shortcut?
I just solved the code coach "the spy life" with Swift, but I am wondering if there's an easier way to code it. I don't think we can post direct solutions here, but basically I learned to use .reversed() to reverse it and then I used a switch case to list EVERY lowercase and uppercase letter of the alphabet plus a space as the characters that should print (see below). Is there a shorter way to have done this? Is there a way to tell it to only choose alphabetically characters so I don't have to list all 52 of them??? for letter in reversed.characters { switch letter { case "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", "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", " ": print(letter) default: break } }