On Tue, Oct 8, 2013, at 10:28, kjaku...@gmail.com wrote:
> I have to define a function add(c1, c2), where c1 and c2 are capital
> letters; the return value should be the sum (obtained by converting the
> letters to numbers, adding mod 26, then converting back to a capital
> letter). 
> 
> All I have so far is:
> 
> def add(c1, c2):
>     ord(c1) - ord('a') + 1
>     ord(c2) - ord('a') + 1
> 
> I know I need to use ord and chr, just not sure how.

Your description says capital letters, but 'a' is a lowercase letter.

Does "mod 26" means A is 1, or is it 0? i.e., is A+A = B or is it A?

What should your function do if the letter isn't a capital letter from
the basic set of 26 English letters?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to