codingbat question broken?

Orochi kartikjagdale11 at gmail.com
Sun Jul 13 22:44:05 CEST 2014


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 at 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 at 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)



More information about the Python-list mailing list