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


Groups > comp.lang.python > #99309

Re: Returning a result from 3 items in a list

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Returning a result from 3 items in a list
Date Tue, 24 Nov 2015 11:35:12 +0100
Organization None
Lines 23
Message-ID <mailman.100.1448361611.2291.python-list@python.org> (permalink)
References <133829df-f57f-442f-9dbf-b22b22f656ae@googlegroups.com> <mailman.98.1448360068.2291.python-list@python.org> <45b60b80-d6b7-423e-93b9-2ef4977fb368@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de Gk8WzKpOSFD7XfNMGyFo2AtSnMcw/dDQBXEWtgcHj1/w==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'nameerror:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'yeah,': 0.09; 'defined;': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'strange,': 0.16; 'wrote:': 0.16; '"",': 0.22; 'defined': 0.23; '(most': 0.24; 'header:User- Agent:1': 0.26; 'subject:list': 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; '14,': 0.27; '13,': 0.29; 'traceback': 0.33; 'file': 0.34; 'gives': 0.35; 'should': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'mean': 0.38; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'results': 0.66; "'result'": 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd94ca.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Xref csiph.com comp.lang.python:99309

Show key headers only | View raw


Cai Gengyang wrote:

> Strange, it gives me an error message when i type result["jordan"] or
> result[max(result)] though :
> 
>>>> results = {
>   "gengyang": 14,
>   "ensheng": 13,
>   "jordan": 12
> }
> 
>>>> result["jordan"]
> Traceback (most recent call last):
>   File "<pyshell#27>", line 1, in <module>
>     result["jordan"]
> NameError: name 'result' is not defined

Yeah, the error message really should be

"NameError: name 'result' is not defined; did you mean 'results'?"

;)

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


Thread

Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 02:04 -0800
  Re: Returning a result from 3 items in a list Chris Angelico <rosuav@gmail.com> - 2015-11-24 21:14 +1100
    Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 02:27 -0800
      Re: Returning a result from 3 items in a list Peter Otten <__peter__@web.de> - 2015-11-24 11:35 +0100
        Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 02:47 -0800
      Re: Returning a result from 3 items in a list Chris Angelico <rosuav@gmail.com> - 2015-11-24 22:05 +1100
        Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 03:06 -0800
  Re: Returning a result from 3 items in a list Peter Otten <__peter__@web.de> - 2015-11-24 11:32 +0100
  Re: Returning a result from 3 items in a list Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-24 14:07 +0000
    Re: Returning a result from 3 items in a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-24 14:28 +0000
      Re: Returning a result from 3 items in a list Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 08:59 -0800
        Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-25 02:26 -0800
          Re: Returning a result from 3 items in a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-25 11:22 +0000

csiph-web