Question: Python What do the following loops print? Work out the answer by tracing the code, not by using the computer. a. s = 2 for
Python What do the following loops print? Work out the answer by tracing the code, not by using the computer. a. s = 2 for n in range (1, 6): s = s + n print(s) b. s = 1 for n in range (1, 11): n = n + 2 s = s + n print(s) c. S = 1 for in range (1, 6) s = s + n n = n + 1 print(s, n) Rewrite the following for loop as a while loop s = 0 for i in range(l, 10): s = s + i Use only the concepts from Chapter 2 thru 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
