Advertisement
nher1625

alphabet_deque

Mar 26th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. __author__ = 'Nasty_Ney' + ' N_N ' + ' XP '
  2.  
  3. from collections import deque
  4. from string import ascii_letters
  5.  
  6. nth_letter = 1
  7. alpha = ascii_letters[26: 53]
  8. alpha_deque = deque(alpha, maxlen=26)
  9.  
  10. while nth_letter < 27:
  11.     first, second, third, all_others = 'st', 'nd', 'rd', 'th'
  12.     current_letter = alpha_deque.popleft()
  13.     # conditional logic
  14.     if nth_letter == 1 or nth_letter == 21:
  15.         print( '{0} is the {1}'.format(current_letter, nth_letter) + first + ' letter of the alphabet.' )
  16.     elif nth_letter == 2 or nth_letter == 22:
  17.         print( '{0} is the {1}'.format(current_letter, nth_letter) + second + ' letter of the alphabet.' )
  18.     elif nth_letter == 3 or nth_letter == 23:
  19.         print( '{0} is the {1}'.format(current_letter, nth_letter) + third + ' letter of the alphabet.' )
  20.     else:
  21.         print( '{0} is the {1}'.format(current_letter, nth_letter) + all_others + ' letter of the alphabet.' )
  22.  
  23.     nth_letter += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement