Python | Sequences exercise | Print a list of integers not expressible in a certain way

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

You can learn how to do this exercise if you attend the course listed below!

Software ==> Python  (25 exercises)
Version ==> Latest version
Topic ==> Sequences  (4 exercises)
Level ==> Harder than average
Classroom ==> Python programming
Online ==> Python programming

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Let's define an owl number as an integer which can be expressed as the sum of at least one integer and the sum of its digits.   For example, the number 371 generates an owl number of 382, since:

  • the value of 371 is 371
  • the sum of its digits is 3 + 7 + 1 = 11
  • the sum of 371 and 11 = 382

Using this information, generate a list of the integers between 1 and 10000 which are not owl numbers:

Start of number list

The start of your output should look like this (group your numbers into 100s).

 

One way to do this is to generate a list of owl numbers, then loop over the integers finding all those not in this list.

When you've finished, close your file down!

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 0 threads Add post