Answer to Question #257576 in Python for Isabel Cortez

Question #257576

4. A Shorter Three

by CodeChum Admin


Numbers in threes are awesome! But the one last time was too lengthy to look at, so I just want to view it in a shorter but still readable format.


You okay with this task?


Instructions:

  1. Print out all numbers from 1 to 100 that is divisible by 3 using a for loop just like the last problem, but this time, with each number only separated by the space like that of the sample output.


Output

A line containing integers divisible by 3 separated by a space.


3 6 9 12 15 18 21 24...
1
Expert's answer
2021-10-29T00:53:47-0400
for i in range(1,100):
  if i%3==0:
    print(i,end=" ")

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