# I am completely stumped on this homework question and cannot figure out how to make the range count down, and I don't know what 5 characters wide means. or how to get the totals. and how to separate the two different multipls from odd and even.  I am able to make the range go from1-300.this is the homework question I have.program4_1.pyWrite a Python program that uses a for loop with the range function to inspect all integers from 300 down to 1. See page 170-172 to learn about the range function. Code in the loop should find exact multiples of 23 and print them in fields 5 characters wide on one line. The loop should also determine two totals; the total of the even multiples and the total of the odd multiples of 23. When the loop ends, the program should display these two totals.

Question
395 views

I am completely stumped on this homework question and cannot figure out how to make the range count down, and I don't know what 5 characters wide means. or how to get the totals. and how to separate the two different multipls from odd and even.

I am able to make the range go from1-300.

this is the homework question I have.

program4_1.py
Write a Python program that uses a for loop with the range function to inspect all integers from 300 down to 1. See page 170-172 to learn about the range function. Code in the loop should find exact multiples of 23 and print them in fields 5 characters wide on one line. The loop should also determine two totals; the total of the even multiples and the total of the odd multiples of 23. When the loop ends, the program should display these two totals.

check_circle

star
star
star
star
star
1 Rating
Step 1

Program Instructions:

• Use -1 to decrement down the count.
• The text can be made 5 characters wide by using %5d, also use end = “ “ to print the numbers in one line.
• Separate the even and odd multiples and add them to get their total.
Step 2

Program:
even_multiples_total = 0

odd_multiples_total = 0

for i in range(300,1,-1):

if i % 23 == 0:

print("%5d"% (i),end="")

if i % 2 == 0:

even_multiples_total+=i

&...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

### Python 