猫史档案馆


python之破解密码(涉及easygui界面模块)

用户:嘻嘻哈哈呵呵呵嘻嘻哈哈呵呵呵查看:0 回复:0 评论:0 创建时间:2021-07-13T15:06:09


代码如下:

import random
import time
from easygui import *


num = []
password_option = []
for i in range(1, 10):
    password_option.append(i)
option = ['6', '8']
pattern = choicebox('What is your pattern','please choice pattern',option)
print((('OK,your pattern is ' + pattern) + ' Loading......'))
pattern = int(pattern)
for i in range(pattern):
    num.append(random.randint(1, 9))
time.sleep(3)
if (pattern == 6):
    print('What a first number? Now , you should guess the number,OK?')
    first_password_number = int(choicebox('What a first number?','please choice number',password_option))
    while (2 > 1):
        if (first_password_number == num[0]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            first_password_number = int(choicebox('What a first number?','please choice number',password_option))
    print('What a second number? Now , you should guess the number,OK?')
    second_password_number = int(choicebox('What a second number?','please choice number',password_option))
    while (2 > 1):
        if (second_password_number == num[1]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            second_password_number = int(choicebox('What a second number?','please choice number',password_option))
    print('What a third number? Now , you should guess the number,OK?')
    third_password_number = int(choicebox('What a third number?','please choice number',password_option))
    while (2 > 1):
        if (third_password_number == num[2]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            third_password_number = int(choicebox('What a third number?','please choice number',password_option))
    print('What a fourth number? Now , you should guess the number,OK?')
    fourth_password_number = int(choicebox('What a fourth number?','please choice number',password_option))
    while (2 > 1):
        if (fourth_password_number == num[3]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            fourth_password_number = int(choicebox('What a fourth number?','please choice number',password_option))
    print('What a fifth number? Now , you should guess the number,OK?')
    fifth_password_number = int(choicebox('What a fifth number?','please choice number',password_option))
    while (2 > 1):
        if (fifth_password_number == num[4]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            fifth_password_number = int(choicebox('What a fifth number?','please choice number',password_option))
    print('What a sixth number? Now , you should guess the number,OK?')
    sixth_password_number = int(choicebox('What a sixth number?','please choice number',password_option))
    while (2 > 1):
        if (sixth_password_number == num[5]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            sixth_password_number = int(choicebox('What a sixth number?','please choice number',password_option))
    print('You guessed the code! You are win! ')
else:
    print('What a first number? Now , you should guess the number,OK?')
    first_password_number = int(choicebox('What a first number?','please choice number',password_option))
    while (2 > 1):
        if (first_password_number == num[0]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            first_password_number = int(choicebox('What a first number?','please choice number',password_option))
    print('What a second number? Now , you should guess the number,OK?')
    second_password_number = int(choicebox('What a second number?','please choice number',password_option))
    while (2 > 1):
        if (second_password_number == num[1]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            second_password_number = int(choicebox('What a second number?','please choice number',password_option))
    print('What a third number? Now , you should guess the number,OK?')
    third_password_number = int(choicebox('What a third number?','please choice number',password_option))
    while (2 > 1):
        if (third_password_number == num[2]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            third_password_number = int(choicebox('What a third number?','please choice number',password_option))
    print('What a fourth number? Now , you should guess the number,OK?')
    fourth_password_number = int(choicebox('What a fourth number?','please choice number',password_option))
    while (2 > 1):
        if (fourth_password_number == num[3]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            fourth_password_number = int(choicebox('What a fourth number?','please choice number',password_option))
    print('What a fifth number? Now , you should guess the number,OK?')
    fifth_password_number = int(choicebox('What a fifth number?','please choice number',password_option))
    while (2 > 1):
        if (fifth_password_number == num[4]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            fifth_password_number = int(choicebox('What a fifth number?','please choice number',password_option))
    print('What a sixth number? Now , you should guess the number,OK?')
    sixth_password_number = int(choicebox('What a sixth number?','please choice number',password_option))
    while (2 > 1):
        if (sixth_password_number == num[5]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            sixth_password_number = int(choicebox('What a sixth number?','please choice number',password_option))
    print('What a fifth number? Now , you should guess the number,OK?')
    seventh_password_number = int(choicebox('What a seventh number?','please choice number',password_option))
    while (2 > 1):
        if (seventh_password_number == num[6]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            seventh_password_number = int(choicebox('What a seventh number?','please choice number',password_option))
    print('What a eigth number? Now , you should guess the number,OK?')
    eigth_password_number = int(choicebox('What a eigth number?','please choice number',password_option))
    while (2 > 1):
        if (eigth_password_number == num[7]):
            break
        else:
            print('No! You guess a number is False!')
            time.sleep(1)
            eigth_password_number = int(choicebox('What a eigth number?','please choice number',password_option))
    print('You guessed the code! You are win! ')


回复

上一页1 页 / 共 0下一页