The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Write a function called manipulate_data which will act as follows:
When given a list of integers, return a list, where the first element is the count of positives numbers and the second element is the sum of negative numbers.
NB: Treat 0 as positive.
Â
Test
import unittest
class ManipulateDataTestCases(unittest.TestCase):
def test_only_lists_allowed(self):
result = manipulate_data({})
self.assertEqual(result, 'Only lists allowed', msg='Invalid argument')
def test_it_returns_correct_output_with_positives(self):
result = manipulate_data([1, 2, 3, 4])
self.assertEqual(result, [4, 0], msg='Invalid output')
def test_returns_correct_ouptut_with_negatives(self):
result = manipulate_data([1, -9, 2, 3, 4, -5]);
self.assertEqual(result, [4, -14], msg='Invalid output')
Â
Â
please i need a solution ASAP
-----------