2
I need to write a program in the Python language that reads multiple entries, and when receiving the "-1" input, the program prints the factorial of the respective input numbers.
Detail: need to use loop function while
, since it is part of the current subject I study. I am writing as follows:
while True:
n = int(raw_input())
if n >= 0:
continue
if n == -1:
break
numeroCalc = n
fatorial = 1
while numeroCalc > 0:
fatorial = fatorial * numeroCalc
numeroCalc = numeroCalc - 1
print fatorial
But it’s not working.
What’s not working? You can use a list or something?
– Maniero
The program does not print the Factorials... The program closes after the "-1" entry, and does not print the factorials.
– Guilherme Santana De Souza
I believe I can use a list, as long as I use the while function
– Guilherme Santana De Souza