converting letters to numbers

Piet van Oostrum piet at vanoostrum.org
Wed Oct 16 16:25:21 EDT 2013


Charles Hixson <charleshixsn at earthlink.net> writes:

> On 10/13/2013 10:02 PM, Steven D'Aprano wrote:
>> On Sun, 13 Oct 2013 20:13:32 -0700, Tim Roberts wrote:
>>
>>> def add(c1, c2):
>>>       % Decode
>>>       c1 = ord(c1) - 65
>>>       c2 = ord(c2) - 65
>>>       % Process
>>>       i1 = (c1 + c2) % 26
>>>       % Encode
>>>       return chr(i1+65)
>> Python uses # for comments, not %, as I'm sure you know. What language
>> were you thinking off when you wrote the above?
>>
>>
>>
> IIRC Lisp uses % for comments, but it may need to be doubled.  (It's
> been doubled in the examples I've seen, and I don't remember the
> syntax.)
> Perhaps Scheme has the same convention, but Scheme could be considered a
> part of the Lisp clade.

Lisp and scheme use semicolon (;). It wouldn't have been that difficult
to look that up I think.
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list