Best Python code snippet using avocado_python
main.py
Source:main.py  
1import random2import sys3count = 44count_A = 45get_B = 06get_num_times = 07user_guess=[]8sy_num=[]9vacant_not_match_user = []10vacant_not_match_sys = []11overlap = 012cheat_mode = 113cheat_mode = int(input("æ¯å¦éåä½å¼ççæ¡æ¨¡å¼?,æ¯è«çµ¦1,å¦åæENTERç¹¼çº")or "0")14print(cheat_mode)15#檢æ¥è¼¸å
¥16while True:17    try:18        user_guess = input("çä¸å0001~9999å使¸å")19        if int(user_guess) == False:20            raise Exception("鿏åæçº0000")21        if len(user_guess) != 4:22            raise Exception("éå使¸å")23        break24    except Exception as e:25        print("鿏åæéå使¸åæè¼¸å
¥0000ï¼è«éæ°æª¢æ¥è¼¸å
¥: ", e)26    except:27        # sys.exc_info()[0] å°±æ¯ç¨ä¾ååºexceptçé¯èª¤è¨æ¯çæ¹æ³28        print("Unexpected error:", sys.exc_info()[0])29user_guess = tuple(user_guess)30#顯示使ç¨è
輸å
¥31#print(user_guess)32#sy_num = "6"33sy_num = str(random.randint(0, 9999))34#æªæ»¿å使¸åè¦è£035if len(sy_num) < count:36    sy_num = sy_num.zfill(count)37sy_num = tuple(sy_num)38vacant_not_match_user = list(user_guess)39vacant_not_match_sys = list(sy_num)40##print ("vas",vacant_not_match_sys)41#é¡¯ç¤ºç³»çµ±é¨æ©ç¢çæ¸å¼42print("çæ¡sys_num=", sy_num)43while count_A != 0:44    print("get_B0=", get_B)45    get_B = 046    get_num_times = 047    count_A = 448    count = 449    vacant_not_match_user = list(user_guess)50    vacant_not_match_sys = list(sy_num)51    #mi_dual_num=052    for x in range(1, count + 1):53        i = 054        print("count=", count)55        print("x= ", x)56        print("user_guess[x-1] & sy_num=", user_guess[x - 1], sy_num[x - 1])57        if user_guess[x - 1] == sy_num[x - 1]:58            ##print("user_guess[x-1]=", user_guess[x - 1], sy_num[x - 1])59            get_num_times = get_num_times + 1  #æ¾å°Aå 160            if cheat_mode == 1:61                print("get_num_times= ", get_num_times)62                print("count=", count)63                print("count-get_num_times=?", count - get_num_times)64            count_A = count_A - 1  #æ¾å°ä¸åAæ£ç¸½æ¸65            #符åAçä½ç½®ææç¨ä¸ç¡äºå
ç´ 66            vacant_not_match_user[x - 1] = '!' + str(x - 1)67            vacant_not_match_sys[x - 1] = '@' + str(x - 1)68            if cheat_mode == 1:            69                print("vacant_not_match_user=", vacant_not_match_user,70                      "vacant_not_match_sys=", vacant_not_match_sys)71    #ç¶éAçç½®æå¾çlistï¼è¦æ¾B72    for k in range(1, count + 1):  73        for i in range(1, count + 1):74            if cheat_mode == 1:          75              print("k,i=", k, i)76            #æ¾å°Bå¾ï¼å°å
©è
ç½®ææç¨ä¸ç¡äºç¬¦èï¼é¿å
䏿¬¡éè¤è¨ç®77            if vacant_not_match_user[k - 1] == vacant_not_match_sys[i - 1]:78                print("B åºç¾å¨ç¬¬ ", i - 1)79                vacant_not_match_sys[i - 1] = '#' + str(i - 1)80                vacant_not_match_user[k - 1] = '$' + str(k - 1)81                get_B = get_B + 182            if cheat_mode == 1:83                print('## vacant_not_match_user', vacant_not_match_user)84                print('## å©ä¸ vacant_not_match_sys= ', vacant_not_match_sys)85            if cheat_mode == 1:86                print("getB,count =", get_B, count_A)87    if cheat_mode == 1:               88        print("get_B=", get_B)89    print("çµææ¯{}A{}B".format(get_num_times, get_B))90    if count_A != 0:91        #éæ°æ¸åå¤è®92        while True:93            try:94                user_guess = input("çä¸å0001~9999å使¸å")95                if int(user_guess) == False:96                    raise Exception("鿏åæçº0000")97                if len(user_guess) != 4:98                    raise Exception("éå使¸å")99                break100            except Exception as e:101                print("鿏åæéå使¸åæè¼¸å
¥0000ï¼è«éæ°æª¢æ¥è¼¸å
¥: ", e)102            except:103                # sys.exc_info()[0] å°±æ¯ç¨ä¾ååºexceptçé¯èª¤è¨æ¯çæ¹æ³104                print("Unexpected error:", sys.exc_info()[0])105    if cheat_mode == 1:                106        print("###çæ¡sys_num=", sy_num)107        print("###get_num_times= ", get_num_times)...classes.py
Source:classes.py  
...9    @get_a.setter10    def get_a(self, a):11        self.__a = a12    @property13    def get_b(self):14        return self.__b15    @get_b.setter16    def get_b(self, b):17        self.__b = b18    @property19    def get_result(self):20        return self.__result21    @get_result.setter22    def get_result(self, result):23        self.__result = result24    def summ(self):25        return self.get_a + self.get_b26    def subtraction(self):27        return self.get_a - self.get_b28    def multiply(self):29        return self.get_a * self.get_b30    def division(self):...Twelfth.py
Source:Twelfth.py  
...4        self.a = a5        self.b = b6    def get_a(self):7        return self.a8    def get_b(self):9        return self.b10    def __add__(self, other):11        return self.get_a() + other.get_a(), self.get_b() + other.get_b()12    def __sub__(self, other):13        return self.get_a() - other.get_a(), self.get_b() - other.get_b()14    def __mul__(self, other):15        return (self.get_a() * other.get_a - self.get_b() * other.get_b,16                self.get_b() * other.get_a + self.get_a() * other.get_b)17    def __floordiv__(self, other):18        return ((self.get_a() * other.get_a + self.get_b() * other.get_b) / (pow(other.get_a, 2) + pow(other.get_b, 2)),19                (self.get_b() * other.get_a - self.get_a() * other.get_b) / (pow(other.get_a, 2) + pow(other.get_b, 2)))20    def modol(self):21        return math.sqrt(math.pow(self.get_a(), 2) + math.pow(self.get_b(), 2))22    def trygonometryczne(self):23        z = self.modol()*(math.cos(self.get_a()/self.modol())+(math.sin(self.get_b()/self.modol())))...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
