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: 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> <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 To: kjakupak@gmail.com Content-Type: text/plain; charset=UTF-8 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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