Support our Blind Hand Charity by donating at 9818291723. Your contribution has the potential to bring about significant positive change for humanity.

Search This Blog

Saturday, December 16, 2023

RANDOM DIGIT WELL

import random as ran

l=[0,0,0,0,0,0,0,0,0]

c=3

acl=[0,0,0,0,0,0,0,0,0]

o=0

c=0

while o!=3:

    print("""Choose the operation to perform:

1. Clockwise

2. Anti Clockwise

3. Exit""")

    o=int(input("Enter the operation number = "))

    if o==3:

        break

    elif o==1:

        c+=1

        m=[0,0,0,0,0,0,0,0,0]

        for i in range(2,-5,-1):

            m[i]=l[i+1]

        if l[5]!=0:

            ac=[0,0,0,0,0,0,0,0,0]

            for i in range(0,8):

                ac[i+1]=acl[i]

            for i in range(0,9):

                acl[i]=ac[i]

            acl[0]=l[5]

        for i in range(0,9):

            l[i]=m[i]

        r=ran.randint(1,9)

        l[3]=r

    elif o==2:

        m=[0,0,0,0,0,0,0,0,0]

        for i in range(-5,3):

            m[i+1]=l[i]

        for i in range(0,9):

            l[i]=m[i]

        if acl[0]!=0:

            l[5]=acl[0]

        ac=[0,0,0,0,0,0,0,0,0]

        for i in range(0,8):

            ac[i]=acl[i+1]

        for i in range(0,9):

            acl[i]=ac[i]

    s=0

    for i in range(0,9):

        if l[i]==0:

            s+=1

    if s==9:

        print("WELL IS EMPTY")

    print(l[2],'│',l[1],'│',l[0])

    print('──┼───┼──')

    print(l[3],'│',l[4],'│',l[8])

    print('──┼───┼──')

    print(l[5],'│',l[6],'│',l[7])

    print('  │   │  ')

OUTPUT