Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Programming Exercises - Page 160: 5.13

Answer

120 150 180

Work Step by Step

$Statement:$ Write a program that displays, with ten numbers per line, all the numbers from 100 to 200 that are divisible by 5 or 6, but not both. The numbers are separated by exactly one space $Code:$ numberPerLine=10 count=0 for a in range(100,200): $ $ $ $ $ $ $ $ if a%5==0 and a%6==0: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ count=count+1 $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ if count%numberPerLine==0: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ print(a) $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ else: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ print(a," ") $Output:$ 120 150 180
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.