write a python program that takes input until user enters 0 and your program should return the sum and product of all integers entered before 0
Answers
Answered by
1
Answer:
rted over about 5 times now and I would really appreciate if someone were to point me in the right direction.
So far, I have this:
num_str = input("Input an integer (0 terminates):")
num_int=int(num_str)
even_count=0
odd_count=0
even_sum=0
odd_sum=0
while num_int !=0:
num_str = input("Input an integer (0 terminates):")
num_int=int(num_str)
for num_int in num_str:
if num_int%2 == 0:
even_count += 1
else:
odd_count +=1
print("")
print("Sum of odds:", odd_sum)
print("Sum of evens:", even_sum)
print("Even count:", even_count)
print("Odd count:", odd_count)
print("Total positive int count:")
Similar questions