Best Python code snippet using avocado_python
3085.py
Source:3085.py
1# '''2# 문ì 3# ìê·¼ì´ë ì´ë ¸ì ì ì "ë´ë³´ë (Bomboni)" ê²ìì ì¦ê²¨íë¤.4#5# ê°ì¥ ì²ìì NÃNí¬ê¸°ì ì¬íì ì±ì ëëë¤. ì¬íì ìì 모ë ê°ì§ ìì ìë ìë¤. ìê·¼ì´ë ì¬íì ìì´ ë¤ë¥¸ ì¸ì í ë 칸ì ê³ ë¥¸ë¤.6# ê·¸ ë¤ì ê³ ë¥¸ 칸ì ë¤ì´ìë ì¬íì ìë¡ êµííë¤. ì´ì , 모ë ê°ì ìì¼ë¡ ì´ë£¨ì´ì ¸ ìë ê°ì¥ 긴 ì°ì ë¶ë¶(í ëë ì´)ì ê³ ë¥¸ ë¤ì ê·¸ ì¬íì 모ë 먹ëë¤.7#8# ì¬íì´ ì±ìì§ ìíê° ì£¼ì´ì¡ì ë, ìê·¼ì´ê° 먹ì ì ìë ì¬íì ìµë ê°ì를 구íë íë¡ê·¸ë¨ì ìì±íìì¤.9#10# ì
ë ¥11# 첫째 ì¤ì ë³´ëì í¬ê¸° Nì´ ì£¼ì´ì§ë¤. (3 ⤠N ⤠50)12#13# ë¤ì Nê° ì¤ìë ë³´ëì ì±ìì ¸ ìë ì¬íì ììì´ ì£¼ì´ì§ë¤. 빨ê°ìì C, íëìì P, ì´ë¡ìì Z, ë
¸ëìì Yë¡ ì£¼ì´ì§ë¤.14#15# ì¬íì ìì´ ë¤ë¥¸ ì¸ì í ë ì¹¸ì´ ì¡´ì¬íë ì
ë ¥ë§ ì£¼ì´ì§ë¤.16#17# ì¶ë ¥18# 첫째 ì¤ì ìê·¼ì´ê° 먹ì ì ìë ì¬íì ìµë ê°ì를 ì¶ë ¥íë¤.19#20# ìì ì
ë ¥ 121# 522# YCPZY23# CYZZP24# CCPPP25# YCYZC26# CPPZZ27# 4*528# 4*529# n*(n-1)+n*(n-1)30#31# ìì ì¶ë ¥ 132# 433# íí¸34# 4ë² íì Yì C를 ë°ê¾¸ë©´ Cì¬í ë¤ ê°ë¥¼ 먹ì ì ìë¤.35# '''36#37#38#39#40#41#42#43#44#45#46#47# global max_cnt48# max_cnt = 049#50# T_array= []51# line = int(input())52# for i in range(line):53# temp = ""54# temp = input()55# temp_list = []56# temp_list = list(temp)57# T_array.append(temp_list)58#59# def move():60# global max_cnt61# for row in range(line):62# for col in range(line):63# if col+1 < line:64# T_array[row][col], T_array[row][col+1] = T_array[row][col+1], T_array[row][col]65# max_cnt = search()66# T_array[row][col+1], T_array[row][col] = T_array[row][col], T_array[row][col+1]67#68# for row in range(line):69# for col in range(line):70# if col+1 < line:71# T_array[col][row], T_array[col+1][row] = T_array[col+1][row], T_array[col][row]72# max_cnt = search()73# T_array[col][row], T_array[col+1][row] = T_array[col+1][row], T_array[col][row]74#75# return max_cnt76#77# def search():78# global max_cnt79# for row in range(line):80# for col in range(line):81# c_row_cnt = 082# p_row_cnt = 083# z_row_cnt = 084# y_row_cnt = 085#86# c_col_cnt = 087# p_col_cnt = 088# z_col_cnt = 089# y_col_cnt = 090#91#92# if T_array[row][col] == 'C':93# c_row_cnt += 194# elif T_array[row][col] == 'P':95# p_row_cnt += 196# elif T_array[row][col] == 'Z':97# z_row_cnt += 198# elif T_array[row][col] == 'Y':99# y_row_cnt += 1100# elif T_array[col][row] =='C':101# c_col_cnt += 1102# elif T_array[col][row] == 'P':103# p_col_cnt += 1104# elif T_array[col][row] == 'Z':105# z_col_cnt += 1106# elif T_array[col][row] == 'Y':107# y_col_cnt += 1108# temp_cnt = max(c_row_cnt,z_row_cnt,p_row_cnt,y_row_cnt,c_col_cnt,p_col_cnt,z_col_cnt,y_col_cnt)109# if temp_cnt > max_cnt:110# return temp_cnt111# else:112# return 0113#114#115#116# print(move())117'''118N * N íë ¬(ì´ì°¨ì ë°°ì´)ë±ì¥1191. ì
ë ¥ì ë°ì 2ì°¨ì ë°°ì´ ìì±1202. í,ì´ ê¸°ì¤ N-1ë² ë°ê¾¸ë ê²½ì°ì ì ì¡´ì¬ -> for문, 1ë² ë°ê¿ë ë§ë¤ ê²ì¬1213. ë°ê¾¸ë©´ ì¬íì ìµë ê°ì ê²ì¬(í,ë ¬) -> ì°ìë ìê¹ì ì´ë»ê² ì ë³? -> ìê¹ ë³ë¡ ë³ì를 ë§ë¤ì´ì ì°ìëë©´ +=1 í´ì¤1225123YCPZY124CYZZP125CCPPP126YCYZC127CPPZZ128'''129C_cnt, P_cnt, Z_cnt, Y_cnt = 1, 1, 1, 1130def loop(N, N_list):131 for i in range(N):132 for j in range(N-1):133 row_search(N_list, i)134 col_search(N_list, j)135 #íê²ì¬136 N_list[i][j], N_list[i][j+1] = N_list[i][j+1], N_list[i][j]137 row_search(N_list,i)138 col_search(N_list,j)139 N_list[i][j+1], N_list[i][j] = N_list[i][j], N_list[i][j+1]140 # print(N_list[i][j])141 #ì´ ê²ì¬142 N_list[j][i], N_list[j+1][i] = N_list[j+1][i], N_list[j][i]143 col_search(N_list, j)144 row_search(N_list, i)145 N_list[j+1][i], N_list[j][i] = N_list[j][i], N_list[j+1][i]146 # for i in range(N):147 # for j in range(N-1):148 # #ì´ ê²ì¬149 # N_list[j][i], N_list[j+1][i] = N_list[j+1][i], N_list[j][i]150 # col_search(N_list, j)151 # row_search(N_list, i)152 # N_list[j+1][i], N_list[j][i] = N_list[j][i], N_list[j+1][i]153 # print(N_list[j][i])154def row_search(N_list,l):155 global C_cnt156 global P_cnt157 global Z_cnt158 global Y_cnt159 temp_c, temp_p, temp_z, temp_y = 1, 1, 1, 1160 for i in range(len(N_list) - 1):161 if N_list[l][i] == N_list[l][i + 1]:162 if N_list[l][i] == 'C':163 temp_c += 1164 elif N_list[l][i] == 'P':165 temp_p += 1166 elif N_list[l][i] == 'Z':167 temp_z += 1168 elif N_list[l][i] == 'Y':169 temp_y += 1170 if C_cnt < temp_c:171 C_cnt = temp_c172 if P_cnt < temp_p:173 P_cnt = temp_p174 if Z_cnt < temp_z:175 Z_cnt = temp_z176 if Y_cnt < temp_y:177 Y_cnt = temp_y178def col_search(N_list,l):179 global C_cnt180 global P_cnt181 global Z_cnt182 global Y_cnt183 temp_c, temp_p, temp_z, temp_y = 1, 1, 1, 1184 for i in range(len(N_list) - 1):185 if N_list[i][l] == N_list[i + 1][l]:186 if N_list[i][l] == 'C':187 temp_c += 1188 elif N_list[i][l] == 'P':189 temp_p += 1190 elif N_list[i][l] == 'Z':191 temp_z += 1192 elif N_list[i][l] == 'Y':193 temp_y += 1194 if C_cnt < temp_c:195 C_cnt = temp_c196 if P_cnt < temp_p:197 P_cnt = temp_p198 if Z_cnt < temp_z:199 Z_cnt = temp_z200 if Y_cnt < temp_y:201 Y_cnt = temp_y202if __name__ == '__main__':203 N = int(input())204 N_list = [list(input()) for i in range(N)]205 loop(N, N_list)206 print(max(C_cnt, P_cnt, Z_cnt, Y_cnt))207 print(C_cnt, P_cnt, Z_cnt, Y_cnt)208'''2095210CPZCC211ZYCPZ212CYYPZ213ZPZCC214CCPYY...
AA.py
Source:AA.py
1# def padding(n, n_list):2# cnt = 03# pad_list = [0 for _ in range(n + 2)]4# n_list.insert(0, pad_list)5# n_list.append(pad_list)6# for idx in range(1, n + 1):7# n_list[idx].insert(0, 0)8# n_list[idx].append(0)9# for i in range(1, n + 1):10# for j in range(1, n + 1):11# print(12# n_list[2][1]13# == max(14# n_list[1][1],15# n_list[1][0],16# n_list[1][2],17# n_list[0][1],18# n_list[2][1],19# )20# )21# if n_list[i][j] == max(22# [23# n_list[i][j],24# n_list[i - 1][j],25# n_list[i + 1][j],26# n_list[i][j + 1],27# n_list[i][j - 1],28# ]29# ):30# cnt += 131# return cnt32# n = int(input())33# n_list = [list(map(int, input().split())) for _ in range(n)]34# print(padding(n, n_list))35# print(n_list)36# print(pad_list)37# ë ë²ì§¸ íì´38dx = [-1, 0, 1, 0]39dy = [0, 1, 0, -1]40n = int(input())41n_list = [list(map(int, input().split())) for _ in range(n)]42n_list.insert(0, [0] * n)43n_list.append([0] * n)44for sub in n_list:45 sub.insert(0, 0)46 sub.append(0)47cnt = 048for i in range(1, n + 1):49 for j in range(1, n + 1):50 if all(n_list[i][j] > n_list[i + dx[k]][j + dy[k]] for k in range(4)):51 cnt += 1...
passwordDecryption.py
Source:passwordDecryption.py
1# Coded by SpiderX23n = input("")4n_list = list(n)5new = []67for i in range(len(n_list)):8 if n_list[i] == "*":9 pass1011 elif str(n_list[i]).islower() and str(n_list[i+1]).isupper():12 n_list[i], n_list[i+1] = n_list[i+1], n_list[i]13 n_list.insert((i+2), "*")1415 elif str(n_list[i]).isnumeric():16 # n_list.insert(0, n_list[i])17 new.insert(0, n_list[i])18 n_list[i] = str(0)1920 else:21 pass222324print(*new, *n_list, sep="")
...
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!!