Answer to Question #232599 in Python for Assignment

Question #232599
Write a python program that prints the following sequence using for/while loop. The
outputs should be shown exactly as the pattern below:
a) 24, 18, 12, 6, 0, -6
b) -10, -5, 0, 5, 10, 15, 20
c) 18, 27, 36, 45, 54, 63
d) 63, 54, 45, 36, 27, 18
1
Expert's answer
2021-09-05T00:32:53-0400
s = 30
for i in range(6):
  s = s - 6
  print(s, end =', ')
24, 18, 12, 6, 0, -6,

s = -15
for i in range(7):
  s = s + 5
  print(s, end =', ')
-10, -5, 0, 5, 10, 15, 20,

s = 9
for i in range(6):
  s = s + 9
  print(s, end = ', ')
18, 27, 36, 45, 54, 63, 

s = 72
for i in range(6):
  s = s - 9
  print(s, end =', ')
63, 54, 45, 36, 27, 18, 

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
APPROVED BY CLIENTS