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


Groups > comp.lang.python > #59046

Re: Help - Exercise Decision

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'elif': 0.05; 'that?': 0.05; 'assignment': 0.07; 'assuming': 0.09; 'combines': 0.09; 'correct,': 0.09; 'debugger': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tismer': 0.09; 'subject:Help': 0.11; 'python': 0.11; "wouldn't": 0.14; '"or"': 0.16; "(i'm": 0.16; 'equal.': 0.16; 'holy': 0.16; 'operator.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sorting': 0.16; 'comment:': 0.16; 'language': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'trying': 0.19; 'else,': 0.19; 'practices,': 0.19; 'entered': 0.20; 'examples': 0.20; '>>>': 0.22; 'programming': 0.22; '(in': 0.22; 'tests': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'regardless': 0.24; 'question': 0.24; 'sort': 0.25; 'second': 0.26; 'post': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'said,': 0.30; "i'm": 0.30; '(which': 0.31; 'code': 0.31; 'lines': 0.31; 'you?': 0.31; '>>>>': 0.31; 'equality': 0.31; 'gary': 0.31; 'please.': 0.31; 'produces': 0.31; 'quite': 0.32; 'guess': 0.33; 'link.': 0.33; "i'd": 0.34; 'message.': 0.35; 'problem': 0.35; 'advice': 0.35; 'problem.': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'method': 0.36; "i'll": 0.36; 'two': 0.37; 'being': 0.38; 'christian': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'extremely': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'greatest': 0.60; 'tell': 0.60; 'numbers': 0.61; 'matter': 0.61; 'world.': 0.61; 'simple': 0.61; 'first': 0.61; "you've": 0.63; 'email addr:gmail.com': 0.63; 'information': 0.63; 'such': 0.63; 'provide': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'here': 0.66; 'between': 0.67; 'different.': 0.84; 'forced': 0.84; 'kennedy': 0.84; 'subject:Decision': 0.84; 'them)': 0.84; 'tie': 0.84; 'ranking': 0.96; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Help - Exercise Decision
Date Mon, 11 Nov 2013 02:59:24 +0000
References <3d585f7b-6e6c-46b8-94d9-33b4b30f11f8@googlegroups.com> <mailman.2356.1384130501.18130.python-list@python.org> <82597e09-1842-41ca-b7af-cb97dc40776f@googlegroups.com> <5280403F.6090404@islandtraining.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host host-78-147-30-243.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
In-Reply-To <5280403F.6090404@islandtraining.com>
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.2362.1384138756.18130.python-list@python.org> (permalink)
Lines 73
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384138756 news.xs4all.nl 15972 [2001:888:2000:d::a6]:55729
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59046

Show key headers only | View raw


On 11/11/2013 02:26, Gary Herron wrote:
> On 11/10/2013 04:48 PM, Kennedy Salvino wrote:
>> Em domingo, 10 de novembro de 2013 21h34min39s UTC-3, Gary Herron
>> escreveu:
>>> On 11/10/2013 02:56 PM, kennedysalvino.ks@gmail.com wrote:
>>>
>>>> I'm trying to make a ranking of 3 numbers and say which the greatest
>>>> and consider whether there is a tie between them, I am not able to
>>>> make the conditions of draws.
>>>> Code in PT-BR: http://pastebin.com/18pYJjPC
>>>
>>>
>>> Please post the code directly in this message.  As a matter of
>>>
>>> safe-browsing practices, I won't follow that link.
>>>
>>>
>>>
>>> One tests for equality (draws as you call them) with the == operator.
>>>
>>> In what way does that not work for you?  Your question is so terse, that
>>>
>>> I'm not sure what you want.  Provide some examples please.
>>>
>>>
>>>
>>> Gary Herron
>>
>> Using only if elif else, here is the code
>
>
>
> Holy HELL man, that's a lot of code for such a simple problem. But
> perhaps your assignment requires you to do it this way. (In which case
> I'd have a word with your teacher.)
>
> But assuming you've got the sorting part correct, (which you don't quite
> -- the three numbers 2 1 3 entered in that order don't sort correctly),
> I'll guess the problem is in the 8 lines you have triple-quoted out, true?
>
> The first of those lines won't do what I think you are trying to do. Try
> this instead (I'm using a, b, and c instead of your variables):
> empate = a==b or a==c
> Each == test produces a True/False value and the "or" combines the two
> into a single True/False. Your code
> empata = a == b or c
> does something much different.
>
> That being said, I have to question what you are going to do with 8 such
> computations. A single test like
> if a==b or b==c or a==c:
> would tell you if any two of the three values are equal. Do you need
> more information than that?
>
> And then I feel compelled to add one more comment: Your method of
> sorting three numbers is extremely wordy and inefficient. What part of
> that did you invent, and what part is forced on you by your teacher? Are
> you allowed to be “smarter” about it, and would you like some advice on
> that part?
>
> Gary Herron
>
>

Regardless of the way the OP goes about it the use of print functions or 
a debugger wouldn't go amiss.

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Thread

Help - Exercise Decision kennedysalvino.ks@gmail.com - 2013-11-10 14:56 -0800
  Re: Help - Exercise Decision Gary Herron <gary.herron@islandtraining.com> - 2013-11-10 16:34 -0800
    Re: Help - Exercise Decision Kennedy Salvino <kennedysalvino.ks@gmail.com> - 2013-11-10 16:48 -0800
      Re: Help - Exercise Decision Gary Herron <gary.herron@islandtraining.com> - 2013-11-10 18:26 -0800
      Re: Help - Exercise Decision Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-11 02:59 +0000
  Re: Help - Exercise Decision Kennedy Salvino <kennedysalvino.ks@gmail.com> - 2013-11-11 03:55 -0800
  Re: Help - Exercise Decision Kennedy Salvino <kennedysalvino.ks@gmail.com> - 2013-11-11 03:55 -0800

csiph-web