.Write a for loop to create a list of all the odd numbers between 15 and up to and not including 75. Write a second for loop to find the average value in the list, then print it.
SCREENSHOT OF THE PYTHON CODE :
PYTHON CODE :
low = 15
high = 75
lst = [] # create the list
count = 0 # initialize with 0
for i in range(15, 75):
if i % 2 == 1:
lst.append(i) # append to the list if it is odd number
count = count + 1
sums = 0
for i in lst:
sums = sums + i # sums all the elements in the list
print("Average :", sums / count) # print the average in the
list
OUTPUT :
Get Answers For Free
Most questions answered within 1 hours.