Q&A Discussions
About def and return
0 Votes
3 Answerswhats wrong with this code
0 Votes
1 AnswerDef longest ():
0 Votes
3 Answersdef print_double(x):
0 Votes
3 AnswersAnyone please help me
1 Vote
5 AnswersWhat does def do again?
1 Vote
2 Answersdef manipulate_data(n):
positives,negatives=[],[]
if not isinstance(n,list):
raise ValueError
return
else:
for i in n:
if i>=0:
positives.append(i)
if i<0
negatives.append(i)
new=[len(positives,sum(negatives)]
return new.
Someone kindly assist I keep running it in unitests and I keep getting errors.
Here's the question:
0 Votes
2 AnswersWhy doesn't this code work?
0 Votes
3 Answersdef manipulate_data(n):
positives,negatives=[],[]
if not isinstance(n,list):
return
else:
for i in n:
if i>=0:
positives.append(i)
if i<0
negatives.append(i)
new=[len(positives,sum(negatives)]
return new.
please the unittest is still telling me that my code failed the "only lists" allowed test.what do I do.
0 Votes
7 AnswersHot today
Code coach popsicles challenge
0 Votes
Sarang
2 Votes
C language question
1 Votes
Buggy app today
1 Votes
How ?
1 Votes
Programming
0 Votes
??
1 Votes