Latest web development tutorials

Python includes exercises 80

Python 100 Li Python 100 Li

Title: There are a bunch of peaches, five monkeys to points on the beach. The first monkey peach average this pile is divided into five parts, one more, one more monkey thrown into the sea, took one. The second monkey the rest of the peaches and the average divided into five parts, one more, it also put more than one thrown into the sea, took a third, fourth, fifth monkeys are doing so and I asked the least number of original beach peach?

Program Analysis: None.

Source Code:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

if __name__ == '__main__':
    i = 0
    j = 1
    x = 0
    while (i < 5) :
        x = 4 * j
        for i in range(0,5) :
            if(x%4 != 0) :
                break
            else :
                i += 1
            x = (x/4) * 5 +1
        j += 1
    print x

The above example output is:

3121

Python 100 Li Python 100 Li