Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 81

Python Exercise Example 81

Python 100 Examples Python 100 Examples

Problem:809??=800??+9?? where ?? represents a two-digit number, 809?? is a four-digit number, the result of 8*?? is a two-digit number, and the result of 9*?? is a three-digit number. Find the two-digit number represented by ?? and the result of 809*??.

**Analysis:** None.

Program source code:

Example (Python 2.0+)

#!/usr/bin/python

-- coding: UTF-8 --

a

=

809

for

i

in

range

(

10

,

100

)

:

b

=

i

a

if

b

=

1000

and

b

<=

10000

and

8

i

<

100

and

9

i

=

100

:

print

b

,

'

= 800 *

'

,

i

,

'

'

,

i

The output of the above example is:


9708  = 800 *  12  + 9 *  12

Python 100 Examples Python 100 Examples