Python Practice Example 81
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*??.
Program 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, ' + 9 * ', i
Output of the above example:
9708 = 800 * 12 + 9 * 12Other Extensions
Python 100 Examples