Noah M.

asked • 10/26/20

python for everyone.

i did this

sum = 0

for i in range(0, 101):

   if i%2 == 0:

       sum = sum + i


but when i am trying to run it, it dont give me any answers. please help

Noah M.

this is for my homework R4.2 Write a loop that computes a. The sum of all even numbers between 2 and 100 (inclusive). b. The sum of all squares between 1 and 100 (inclusive). c. The sum of all odd numbers between a and b (inclusive). d. The sum of all odd digits of n. (For example, if n is 32677, the sum would be 3 + 7 + 7 = 17.)
Report

10/26/20

1 Expert Answer

By:

Rudy M. answered • 10/26/20

Tutor
New to Wyzant

Seasoned Tutor w/ upwards of 7 years experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.