Question

.Write a for loop to create a list of all the odd numbers between 15 and...

.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.

Homework Answers

Answer #1

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 :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program in C that calculate and print the summation of odd numbers between 1-15...
Write a program in C that calculate and print the summation of odd numbers between 1-15 and then find the average of the summation of these numbers, please use double data type to declare all variables. Use for or do/while loop, please explain the steps aswell
1) Use a loop structure to calculate the sum of all odd numbers from 1 to...
1) Use a loop structure to calculate the sum of all odd numbers from 1 to 15 2) Use a loop structure to calculate the product of all odd numbers from 1 to 9. 3) Write a program to convert US dollars to Bangaldeshi taka
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a program to input a sequence of 8 integers, count all the odd numbers and...
Write a program to input a sequence of 8 integers, count all the odd numbers and sum all the negative integers. One integer is input and processed each time around the loop. Python Programming
Write an R code to print out all even numbers from the following numbers list in...
Write an R code to print out all even numbers from the following numbers list in the same order they are received. Write the code so it does not print any numbers that come after 83. numbers = [951, 40, 84, 51, 60, 69, 48, 19, 61, 85, 98, 50, 72, 47, 44, 61, 83, 65, 41, 51, 63, 61, 65, 75, 21, 30, 84, 92, 23]
Write a program with while loop that prints all numbers between 5 and 100 (inclusive) that...
Write a program with while loop that prints all numbers between 5 and 100 (inclusive) that are divisible by 5.
Prime Numbers) Write a program to calculate and print a list of all prime numbers from...
Prime Numbers) Write a program to calculate and print a list of all prime numbers from 1 to 100. C programming
Write a program in python that prints the count of all prime numbers between A and...
Write a program in python that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = The 5 digit unique number you had picked at the beginning of the semester B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2,...
PYTHON 3 Write a program that prints the count of all prime numbers between A and...
PYTHON 3 Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 21212 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules: You should first...
Write a program in MASM (32 bit) that calculates the sum of all odd numbers in...
Write a program in MASM (32 bit) that calculates the sum of all odd numbers in the Fibonacci sequence between 0 and 1,000,000. ***Please Complete in MASM 32 bit!!***
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT