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


Groups > comp.lang.python > #74405

Re: codingbat question broken?

Newsgroups comp.lang.python
Date 2014-07-13 13:44 -0700
References <CABRP1o_xZYrojpjpT6u11jM1TTOp6aPBELsF4oYo3CLdeFLzZA@mail.gmail.com> <mailman.11782.1405217961.18130.python-list@python.org>
Message-ID <44a21cf0-8de0-48d3-a304-fe98ab3fc327@googlegroups.com> (permalink)
Subject Re: codingbat question broken?
From Orochi <kartikjagdale11@gmail.com>

Show all headers | View raw


On Sunday, 13 July 2014 07:49:18 UTC+5:30, Chris Angelico  wrote:
> On Sun, Jul 13, 2014 at 12:05 PM, Rodrick Brown <rodrick.brown@gmail.com> wrote:
> 
> >
> 
> > Can anyone show me an example where all test are success?
> 
> 
> 
> No, because that's asking for the answer :) What you need to do is
> 
> look at the failing test cases, and figure out why your function is
> 
> giving the wrong result. Do you see what's true of all the failing
> 
> cases and is not true of any others? That might give you a clue as to
> 
> what's wrong.
> 
> 
> 
> ChrisA



On Sunday, 13 July 2014 07:49:18 UTC+5:30, Chris Angelico  wrote:
> On Sun, Jul 13, 2014 at 12:05 PM, Rodrick Brown <rodrick.brown@gmail.com> wrote:
> 
> >
> 
> > Can anyone show me an example where all test are success?
> 
> 
> 
> No, because that's asking for the answer :) What you need to do is
> 
> look at the failing test cases, and figure out why your function is
> 
> giving the wrong result. Do you see what's true of all the failing
> 
> cases and is not true of any others? That might give you a clue as to
> 
> what's wrong.
> 
> 
> 
> ChrisA

This Is My Code(using Python 2.7)
Its working fine with the given test cases.
#Lucky_Sum
a =[]
def lucky_sum(list):
    t = 0
    for item in list:
        if item == 13:
            break
        else:
            t=t+item
    return t

list=[]
type(list)
n = raw_input("Enter Numebr of item in list: ")
n = int(n)
        
for x in range (0,n):
    list.append(int(raw_input()))
print "List is :",list
        
print lucky_sum(list)

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


Thread

Re: codingbat question broken? Chris Angelico <rosuav@gmail.com> - 2014-07-13 12:19 +1000
  Re: codingbat question broken? Orochi <kartikjagdale11@gmail.com> - 2014-07-13 13:44 -0700

csiph-web