Python Five Fish
# Python3.x Python Five People Dividing Fish
[ Python3 Examples](#)
A, B, C, D, and E went fishing together one night. By the next morning, they were all exhausted, so each went to find a place to sleep.
When the sun was high in the sky, A woke up first. He divided the fish into five equal parts, threw away the extra one, and took his share.
B woke up second, also divided the fish into five equal parts, threw away the extra one, and took his share.
C, D, and E woke up in turn and took their fish in the same way.
What is the minimum number of fish they must have caught?
## Example
def main():
fish =1
while True:
total, enough = fish,True
for _ in range(5):
if(total - 1) % 5==0:
total =(total - 1)// 5 * 4
else:
enough =False
break
if enough:
print(f'Total fish: {fish}')
break
fish +=1
if __name__ =='__main__':
main()
Output:
Total fish: 3121
[ Python3 Examples](#)
YouTip