0
Create a program in Python that, for any list of integer values, gets (through functions) and prints on the screen, the amount of positive, null and negative values of the list.
My doubt is to do this counting by functions, always end up returning a wrong value the only 1.
def contaPositivo(lista):
positivo = 0
for num in lista:
if num >0:
positivo = positivo + 1
return positivo
def contaNegativo(lista):
negativo = 0
for num in lista:
if num < 0:
negativo = negativo + 1
return negativo
lista = list()
q = int(input('Quantos valores haverá na lista ?'))
while q < 0:
print('Erro')
q = int(input('Quantos valores haverá na lista ?'))
for c in range(q):
num = int(input('Valor:'))
lista.append(num)
Milton, edit the question and put your code.
– Luiz Augusto