Answer to Question #98074 in Python for Tobe

Question #98074
Write a loop to print 11 to 35 inclusive (this means it should include both the 11 and 35), 5 per line.

Sample Run
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27 28 29 30
31 32 33 34 35
1
Expert's answer
2019-11-08T08:09:29-0500
for i in range(11, 36):
	print(i, end = ' ')
	if i % 5 == 0:
		print()


#with ternary operator:
#for i in range(11, 36):
#	print(i, end = ' ' if i % 5 != 0 else '\n')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS