Code:
Here is the code. Also screenshot of the code and text file containing the code have been attached here.
This code has been written in Python 3.0
# getting input
lst = [ ]
n = 5
for i in range(0, n):
ele = int(input())
lst.append(ele)
print(lst)
# getting odd numbers and even numbers from list and compute average
odd_sum = 0
even_sum = 0
odd = 0
even = 0
for i in range(0, n):
if lst[i] % 2 == 0:
even_sum = even_sum + lst[i]
even = even + 1
elif lst[i] % 2 > 0:
odd_sum = odd_sum + lst[i]
odd = odd + 1
odd_avg = odd_sum/odd
even_avg = even_sum/even
print("there were",odd,"odd numbers in input")
print("there were",even,"odd numbers in input")
print("average of odd numbers in the list",odd_avg)
print("average of even numbers in the list",even_avg)