5

Review of your code You should mostly prefer the in operator instead __contains__. See @HeapOverflow's comment for more details. According to PEP 8, you should not prefer CamelCase for variable names. Use snake_case instead. temp = input().split() N = int(temp[0]) M = int(temp[1]) Can be replaced with M, N = [int(x) for x in input().split()] And the ...


1

The algorithm is slow since it creates paths in all 4 directions at each step. The algorithm is also using recursion, which is also slower than a simple for loop. Consider a 5x5 matrix A: [[1 1 1 1 0] [1 1 1 1 1] [1 1 1 1 1] [1 0 1 1 1] [1 1 1 1 1]] to find the distance of the top-left cell, the algorithm first moves down, then up, then right, and then ...


1

Line continuations They're possible but discouraged. access_tokens = user.social_auth \ .filter(provider='twitter')[0] \ .extra_data['access_token'] would be better, according to most linters, as access_tokens = ( user.social_auth .filter(provider='twitter')[0] .extra_data['access_token'] ) List formation friend_list = [] for i in ...


Only top voted, non community-wiki answers of a minimum length are eligible