import random
import time
import os
def cls():
    os.system('cls')
while True:
    cls()
    print(' Menu ',
                '\n5 - пятизначные ',
                '\n6 - шестизначные',
                '\n7 - семизначные',
                '\n8 - восьмизначные',
                  )
    operation = input('Choose youroperation: ')
    print (operation)
    if operation == '5' :
            cls()
            a = random.randint(10000, 99999)
            print('1 num =', int((a%100000)/10000))
            time.sleep(2)
            cls()
            print('2 num =', int((a%10000)/1000))
            time.sleep(2)
            cls()
            print('3 num =', int((a%1000)/100))
            time.sleep(2)
            cls()
            print('4 num =', int((a%100)/10))
            time.sleep(2)
            cls()
            print('5 num =', int((a%10)))
            time.sleep(2)
            cls()
            c = int(input('введите число :'))
            if(a == c):
                print('CORRECT')
                time.sleep(3)
            else:
                print('INCORRECT')
                print(a)
                time.sleep(3)
    elif operation == '6':
            cls()
            a = random.randint(100000, 999999)
            print('1 num =', int((a%1000000)/100000))
            time.sleep(2)
            cls()
            print('2 num =', int((a%100000)/10000))
            time.sleep(2)
            cls()
            print('3 num =', int((a%10000)/1000))
            time.sleep(2)
            cls()
            print('4 num =', int((a%1000)/100))
            time.sleep(2)
            cls()
            print('5 num =', int((a%100)/10))
            time.sleep(2)
            cls()
            print('6 num =', int((a%10)))
            time.sleep(2)
            cls()
            c = int(input('введите число :'))
            if(a == c):
                print('CORRECT')
                time.sleep(3)
            else:
                print('INCORRECT')
                print(a)
                time.sleep(3)
    elif operation == '7':
            cls()
            a = random.randint(1000000, 9999999)
            print('1 num =', int((a%10000000)/1000000))
            time.sleep(2)
            cls()
            print('2 num =', int((a%1000000)/100000))
            time.sleep(2)
            cls()
            print('3 num =', int((a%100000)/10000))
            time.sleep(2)
            cls()
            print('4 num =', int((a%10000)/1000))
            time.sleep(2)
            cls()
            print('5 num =', int((a%1000)/100))
            time.sleep(2)
            cls()
            print('6 num =', int((a%100)/10))
            time.sleep(2)
            cls()
            print('7 num =', int((a%10)))
            time.sleep(2)
            cls()
            c = int(input('введите число :'))
            if(a == c):
                print('CORRECT')
                time.sleep(3)
            else:
                print('INCORRECT')
                print(a)
                time.sleep(3)
    elif operation == '8':
            cls()
            a = random.randint(10000000, 99999999)
            print('1 num =', int((a%100000000)/10000000))
            time.sleep(2)
            cls()
            print('2 num =', int((a%10000000)/1000000))
            time.sleep(2)
            cls()
            print('3 num =', int((a%1000000)/100000))
            time.sleep(2)
            cls()
            print('4 num =', int((a%100000)/10000))
            time.sleep(2)
            cls()
            print('5 num =', int((a%10000)/1000))
            time.sleep(2)
            cls()
            print('6 num =', int((a%1000)/100))
            time.sleep(2)
            cls()
            print('7 num =', int((a%100)/10))
            time.sleep(2)
            cls()
            print('8 num =', int((a%10)))
            time.sleep(2)
            cls()
            c = int(input('введите число :'))
            if(a == c):
                print('CORRECT')
                time.sleep(3)
            else:
                print('INCORRECT')
                print(a)
                time.sleep(3)
    else:
        print('operation is not defined')
        time.sleep(3)


