Question: i = 1 print (Using the while loop: ) while (i

i = 1 print ("Using the while loop: ") while (i <= 280): print (i, end= " ") i += 31; l = [i for i in range(1,281,31)] print (" Using the for loop with a list:") for ele in l: print (ele, sep=", ", end = " ")

print (" Using the for loop with range, three arguments: ") for i in range(1,281,31): print (i, sep=", ", end = " ")

print (" Using the for loop with range, one argument: ") for i in range(281): if i % 31 == 1: print (i, end = " ")

how do i make the out put like this with a comma and space using str method and without using any additional variables in the code with the loops and you should not use the if statement in the implementation. Nor should you use a second while statement as a "hidden" if statement. :

Using the while loop: 1, 32, 63, 94, 125, 156, 187, 218, 249, 280 Using the for loop with a list: 1, 32, 63, 94, 125, 156, 187, 218, 249, 280 Using the for loop with range, three argument: 1, 32, 63, 94, 125, 156, 187, 218, 249, 280 Using the for loop with range, one argument: 1, 32, 63, 94, 125, 156, 187, 218, 249, 280

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!