2
valores = []
valor1 = valores.append(int(input('Valor 1: ')))
valor2 = valores.append(int(input('Valor 2: ')))
if valor1 in valores > 0:
print(valor1, 'é positivo')
else:
print(valor1, 'é negativo')
if valor2 in valores > 0:
print(valor2, 'é positivo')
else:
print(valor2, 'é negativo')
When executing the code, we insert the two values and in the end both are negative because they are "None":
Valor 1: 10
Valor 2: 20
None é negativo
None é negativo
I wanted to understand why values are returning None, what is wrong.
You’re making
valor1 = valores.append(...)
; the return of functionappend
isNone
.– Woss
About your condition
valor1 in valores > 0
, read the discussion: https://answall.com/q/241769/5878– Woss