Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using python Problem 5 (10 points). How many times does the body of the while lo

ID: 3857104 • Letter: U

Question

Using python
Problem 5 (10 points). How many times does the body of the while loop repeat? What is the output of each loop? i=1 while i < 10: if i % 2 == 0: print(i) i += 1 Using python
Problem 5 (10 points). How many times does the body of the while loop repeat? What is the output of each loop? i=1 while i < 10: if i % 2 == 0: print(i) i += 1
Problem 5 (10 points). How many times does the body of the while loop repeat? What is the output of each loop? i=1 while i < 10: if i % 2 == 0: print(i) i += 1
Problem 5 (10 points). How many times does the body of the while loop repeat? What is the output of each loop? i=1 while i < 10: if i % 2 == 0: print(i) i += 1

Explanation / Answer

i=1

i<10 ->true ,it will enter in while
if(i%2==0) ->false

i+=1 ->i=2

i<10 ->true ,it will enter in while
if(i%2==0) ->true
print 2

i+=1 ->i=3

i<10 ->true ,it will enter in while
if(i%2==0) ->false

i+=1 ->i=4

i<10 ->true ,it will enter in while
if(i%2==0) ->true

i+=1 ->i=5

and so on.
simillarly for all even values of i less than 10 program will print the "i"
and for odd values it won't print anything

Final Output will be : 2 4 6 8

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote