72.6k views
3 votes
Write a Python program segment, using a loop, to calculate and print the sum of the odd integers from 20 to 120. (Hint: 21 23 25 . . . 117 119)

User Dubs
by
4.6k points

1 Answer

5 votes

Answer:

for x in range(20,120):

if x % 2 == 0:

continue

print(x)

Step-by-step explanation:

in a range of 20 to 120 it does the following, if x is divisible by two as an int, then try again with a new number. If not, print that number.

User Xyanight
by
5.6k points