Postive sales | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Postive sales

Problem Statement: The e-commerce company has a list of sales values of N days. Some days the company made a profit, represented as a positive sales value, other days the company incurred a loss, represented as a negative sales value. The company wishes to know the number of profitable days in the list Write the algorithm to help the company know the number of profitable days in the list. INPUT FORMAT The first line of input consists of an integer - numDays representing the number of days [N]. The second line of input consists of N space separated integers sales[0], sales[1], ...... sales[N-1] representing the sales value of N days respectively. OUTPUT FORMAT Print an integer representing the number of days the company made a profit. Evaluation Parameters Sample Input 7 23 -7 13 -34 56 43 -12 Sample Output 4 Explanation The number of positive sales values in the list is 4. Hence the output is 4. OUTPUT: https://code.sololearn.com/chYKKgZ021Q3/?ref=app

29th Sep 2021, 4:44 AM
Manoj Kumar T
Manoj Kumar T - avatar
5 Answers
0
Show your attempt.
29th Sep 2021, 4:46 AM
Simon Sauter
Simon Sauter - avatar
0
it doesn't need complex instructions nums = input().split(' ') count = 0 for i in nums: if int(i) > 0: count+=1 print(count)
29th Sep 2021, 4:53 AM
Erlénio.RS
Erlénio.RS - avatar
0
Getting 1 has output instead of 4 for ur code
29th Sep 2021, 4:54 AM
Manoj Kumar T
Manoj Kumar T - avatar
0
Manoj The output depends on your input, it may vary
29th Sep 2021, 4:56 AM
Erlénio.RS
Erlénio.RS - avatar