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


Groups > comp.lang.python > #51284

Re: Help

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'definitions': 0.07; 'exit': 0.09; 'subject:Help': 0.11; 'python': 0.11; "'break'": 0.16; 'dictionary),': 0.16; 'dictionary,': 0.16; 'dictionary.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'quit.': 0.16; 'sentinel': 0.16; 'skipped.': 0.16; 'through,': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'things.': 0.19; 'seems': 0.21; '2.x': 0.24; 'adds': 0.24; 'replace': 0.24; 'looks': 0.24; 'second': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'words': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'asked': 0.31; 'getting': 0.31; 'too.': 0.31; 'helpful.': 0.31; 'piece': 0.31; 'fri,': 0.33; 'guess': 0.33; 'actual': 0.34; 'problem': 0.35; 'definition': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'version': 0.36; 'doing': 0.36; 'entry': 0.36; 'useful': 0.36; 'implement': 0.38; 'branch': 0.38; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'short': 0.38; 'extremely': 0.39; 'to:addr:python.org': 0.39; 'major': 0.40; 'dangerous': 0.60; 'most': 0.60; 'hope': 0.61; 'new': 0.61; 'digital': 0.61; 'simple': 0.61; "you're": 0.61; 'information': 0.63; 'name': 0.63; 'sincerely': 0.63; 'forward': 0.65; 'finish': 0.65; 'here': 0.66; '26,': 0.68; 'jul': 0.74; '2013': 0.98
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 :content-type; bh=xY9XRWOjzI0lRJI9fziXEoP/e/0b/aO9w3u27WTp4iU=; b=hxRshF5PqThp53xiObeCeJ08gJM9uMsTyu7hBI8CEd18N0s5y9luAPRDzBTZkIlkbu jrPslnr7C7TmrN/+4+FL4qgoPgaUOfci6Bo0JaMHAQDfLdC4E2Ga7sRHC8iexXCU7sc0 FktjcvUruGpYJ7T3HNSiOPkh8zGzz0EPgRBc5a/DdIM+tAHLMRDZ9OUn/Nl0+qlgfvU4 HlRAOVfVT/gD8Cw8PUPItnTt8nbArnZNgHRAZbYTeKX3RDIPSwD9Prt6PszCcQVZMkMT YWLDalO1pOkec5rAwyhGHHPt7Nmz/g4BfX9Li77M1+b95q84aOqjvVwNkhmh3+WcSOx7 ZklA==
MIME-Version 1.0
X-Received by 10.68.13.132 with SMTP id h4mr14443699pbc.99.1374816942051; Thu, 25 Jul 2013 22:35:42 -0700 (PDT)
In-Reply-To <067018ce-ca0c-415b-a5d3-3c2f79f11e8e@googlegroups.com>
References <067018ce-ca0c-415b-a5d3-3c2f79f11e8e@googlegroups.com>
Date Fri, 26 Jul 2013 06:35:41 +0100
Subject Re: Help
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5133.1374816945.3114.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374816945 news.xs4all.nl 15977 [2001:888:2000:d::a6]:42231
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51284

Show key headers only | View raw


On Fri, Jul 26, 2013 at 6:06 AM,  <tyler@familyrobbins.com> wrote:
> I'm a bit new to python and I'm trying to create a simple program which adds words and definitions to a list, and then calls them forward when asked to.

One of the most important tidbits of information is: What version of
Python are you using?

> print("Welcome to Digital Dictionary V1.0!\n\n")

This looks like Python 3 style, though it would be valid Python 2 too.

>     choice = input("Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. ")

And I sincerely hope that this is Python 3, otherwise it would be
doing some very strange and dangerous things. However, relying on us
to guess isn't particularly safe, and works only for the major branch
of 2.x vs 3.x. The actual version you're using will be helpful.

>         while finish < 1:
>             if True:
>                 finish = 1
>                 entry = 0
>                 definition = 0

You're doing a lot with sentinel values, and it's getting a bit
confusing. Your problem here seems to be that 'finish' is never reset,
so the second time through, your loop is completely skipped. I
recommend instead that you use 'break' to exit your loops.

In a piece of somewhat amusing irony, you're here trying to implement
a dictionary. Python has an object type of that name ('dict' is short
for dictionary), which will be extremely useful here. I advise you to
explore it - it'll replace your words[] and dictionary[] lists.

ChrisA

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


Thread

Help tyler@familyrobbins.com - 2013-07-25 22:06 -0700
  Re: Help alex23 <wuwei23@gmail.com> - 2013-07-26 15:21 +1000
  Re: Help Peter Otten <__peter__@web.de> - 2013-07-26 07:27 +0200
  Re: Help Chris Angelico <rosuav@gmail.com> - 2013-07-26 06:35 +0100
  Re: Help Terry Reedy <tjreedy@udel.edu> - 2013-07-26 01:46 -0400
  Re: Help tyler@familyrobbins.com - 2013-07-26 20:40 -0700

csiph-web