Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56413

Re: converting letters to numbers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.044
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'assignment': 0.07; "'a'": 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'wrote': 0.14; 'letters.': 0.16; 'ordinal': 0.16; 'all,': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'looks': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'subject:numbers': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'most': 0.60; 'lower': 0.61; 'providing': 0.61; 'first': 0.61; 'refer': 0.63; 'to:addr:gmail.com': 0.65; 'upper': 0.74; 'joel': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iNxR7YziWAL9rrYifzdUQRaMvR3l284KlpI+h1FMXhk=; b=ZMF6NX3OdC/40E6XOV/1DFtduFwRjUBRb3qGExsynzLRMc0RyWClaU7RAXnAc86h7+ 6Za6JQez3XPSxE1aHPKl4s4L9miJFWJoN9KlWkMIB2+fyYB6G4DfUwaGCny694oEmFG6 4GCEUnDTmPrejV7qjy/CsYWL8pzN8o4fATWVesaN6LFJ6bBeudY6p7A6thVkkaLzqrCV Sx5MTB+Eh8Zfsc+O98xV9Hf58JcoI24aKEvohauJnSF7cqZj0P1QvCjKamONZKFKAIaI BAZE3CEw9Gfk8fOhxwWWojd3zA7bexmUb3MzkY5NqKj+QEV3AGpVATFAI9rCCQt9Ccaa so2w==
MIME-Version 1.0
X-Received by 10.205.74.69 with SMTP id yv5mr1999365bkb.35.1381244472863; Tue, 08 Oct 2013 08:01:12 -0700 (PDT)
In-Reply-To <32293336-949a-448c-bc1c-a7ac5186fcb6@googlegroups.com>
References <26151b64-4f5e-4ee9-81ac-26679932f43d@googlegroups.com> <mailman.856.1381243701.18130.python-list@python.org> <32293336-949a-448c-bc1c-a7ac5186fcb6@googlegroups.com>
Date Tue, 8 Oct 2013 11:01:12 -0400
Subject Re: converting letters to numbers
From Joel Goldstick <joel.goldstick@gmail.com>
To kjakupak@gmail.com
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.857.1381244474.18130.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1381244474 news.xs4all.nl 15943 [2001:888:2000:d::a6]:51767
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56413

Show key headers only | View raw


You wrote this:

def add(c1, c2):
    ord(c1) - ord('a') + 1
    ord(c2) - ord('a') + 1

First of all, this looks like homework.  People will help you with
concepts here, but most frown on just providing answers.  With that in
mind look at this:

>>> ord('A')
65
>>> ord('a')
97
>>>

In your assignment you refer to Upper case letters.  In your code you
take the ordinal value of lower case 'a'


-- 
Joel Goldstick
http://joelgoldstick.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

converting letters to numbers kjakupak@gmail.com - 2013-10-08 07:28 -0700
  Re: converting letters to numbers Robert Day <robertkday@gmail.com> - 2013-10-08 15:47 +0100
    Re: converting letters to numbers kjakupak@gmail.com - 2013-10-08 07:51 -0700
      Re: converting letters to numbers Joel Goldstick <joel.goldstick@gmail.com> - 2013-10-08 11:01 -0400
  Re: converting letters to numbers random832@fastmail.us - 2013-10-08 11:36 -0400
    Re: converting letters to numbers kjakupak@gmail.com - 2013-10-08 08:44 -0700
      Re: converting letters to numbers random832@fastmail.us - 2013-10-08 11:58 -0400
      Re: converting letters to numbers Tim Roberts <timr@probo.com> - 2013-10-13 20:13 -0700
        Re: converting letters to numbers Steven D'Aprano <steve@pearwood.info> - 2013-10-14 05:02 +0000
          Re: converting letters to numbers Charles Hixson <charleshixsn@earthlink.net> - 2013-10-16 12:18 -0700
            Re: converting letters to numbers Piet van Oostrum <piet@vanoostrum.org> - 2013-10-16 16:25 -0400
          Re: converting letters to numbers Rotwang <sg552@hotmail.co.uk> - 2013-10-16 23:39 +0100
            Re: converting letters to numbers MRAB <python@mrabarnett.plus.com> - 2013-10-16 23:53 +0100
            Re: converting letters to numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-10-17 01:21 +0100
          Re: converting letters to numbers Tim Roberts <timr@probo.com> - 2013-10-19 16:31 -0700
          Re: converting letters to numbers rusi <rustompmody@gmail.com> - 2013-10-20 01:33 -0700
  Re: converting letters to numbers Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-08 17:05 +0100
  Re: converting letters to numbers Dave Angel <davea@davea.name> - 2013-10-08 21:24 +0000

csiph-web