Menuangkan 8 liter ke dalam 2 wadah kosong ukuran 3 dan 5 untuk mendapatkan 4 liter dalam wadah apa pun

# Python Code
import time
print("This a liquid pouring challenge")
print("\nYou are required to get 4 litres")
print("in any container by emptying and/or leaving in other container")
# C Represents Container
F = 1
while F == 1:
    C1 = 8
    print("\nContainer 1 which comes fill with 8 litres")
    C2 = 0
    print("Container 2 which comes empty with a MAX of five litres")
    C3 = 0
    print("Container 3 which comes empty with a MAX of 3 litres")

    print("Container 1=", C1, "       Container 2=", C2, "       Container 3=", C3)
    IA1 = int(input("Enter the Amount you wish to pour from Container 1 to Container 2: "))
    C1 -= IA1
    C2 = IA1
    IA2 = int(input("Enter the Amount you wish to pour from Container 2 to Container 3: "))
    C2 -= IA2
    C3 = IA2
    IA3 = int(input("Enter the Amount you wish to pour from Container 3 To Container 1: "))
    C3 -= IA3
    C1 += IA3
    IA4 = int(input("Enter the Amount you wish to pour from Container 2 to Container 3: "))
    C2 -= IA4
    C3 = IA4
    IA5 = int(input("Enter the Amount you wish to pour from Container 1 to Container 2: "))
    C1 -= IA5
    C2 += IA5
    IA6 = int(input("Enter the Amount you wish to pour from Container 2 to Container 3: "))
    C2 -= IA6
    C3 += IA6
    IA7 = int(input("Enter the Amount you wish to pour from Container 3 to Container 1: "))
    C1 += IA7

    if C2 > 5:
        print("\nContainer 2 is running over")
    if C3 > 3:
        print("\nContainer 3 is running over")
    if C1 == 4 or C2 == 4:
        print("\nGoal has been achieved, you have successfully put 4 litre in a container")
        print("Congratulation!!!!!")
        F = 0
    else:
        print("\nYour have failed!!!!")
        F = 1

    print("\nContainer 1 now has ", C1, " litres")
    print("Container 2 now has ", C2, " litres")

time.sleep(5.5)
Troubled Teira