💩 Before
for rate in failureRate:
answer.append(rate[0])
👍 After
answer = [i[0] for i in failureRate]
+) one line if else statement
print("A") if a > b else print("B")
💩 Before
answer = [[0] for i in range(N)]
for i in list:
answer[i-1] += 1
👍 After
answer = []
for i in range(1,N+1):
count = list.count(i)
answer.append(count)
💩 Before
dp = []
for _ in range(n):
dp.append([0 for _ in range(m)])
for i in range(n):
for j in range(m):
dp[i][j] = inputs[m*i+j]
👍 After
dp = []
index = 0
for i in range(n):
dp.append(inputs[index:index + m])
index += m