Python
-
Practice>Python>Python Functionals>Validating Email Addresses With a Filterhackerrank.com 2019. 3. 21. 13:07
hackerrank.comValidating Email Addresses With a FilterProblem link : https://www.hackerrank.com/challenges/validate-list-of-email-address-with-filter/problemDifficulty : Medium TipProblem should be for regular expression, not for filter lol :)Write regular expression to validate email addressimport re
-
Practice>Python>Python Functionals>Map and Lambda Functionhackerrank.com 2019. 3. 21. 12:58
hackerrank.comMap and Lambda FunctionProblem link : https://www.hackerrank.com/challenges/map-and-lambda-expression/problemDifficulty : Easy TipImplement cube lambda function by using **fibonacci function should return l[0:n], not return lIt seems that test case input 1 Solution # complete the lambda function cube = lambda x: x**3 def fibonacci(n): l = [0, 1] for i in range(2, n): print(i) l.app..
-
Practice<Python<Built-Ins<Input()hackerrank.com 2019. 3. 20. 13:14
hackerrank.comInput()Problem link : https://www.hackerrank.com/challenges/input/problem?h_r=next-challenge&h_v=zenDifficulty : Easy Tipyou already know input()The key is to understand eval()we describe python code into python stringwe can run the python code, if we give the string to eval() function Solution x, k = map(int, input().split(' ')) stmt = input() r = eval(stmt) print(k == r)
-
Practice>Python>Built-Ins>Zipped!hackerrank.com 2019. 3. 20. 13:09
hackerrank.comZipped!Problem link : https://www.hackerrank.com/challenges/zipped/problemDifficulty : Easy TipThe important thing regarding zip(), is that zip() exchange x dimension and y dimension of matrix like listNormally, we place each student in the first column of each rowHowever, in the problem description, whole students are placed in the row Solution # Enter your code here. Read input f..
-
Practice>Python>Classes>Class 2 - Find the Torsional Anglehackerrank.com 2019. 3. 19. 13:15
hackerrank.comClass 2 - Find the Torsional AngleProblem link : https://www.hackerrank.com/challenges/class-2-find-the-torsional-angle/problemDifficulty : Easy, (It should be Medium at least) TipUsing class in python is not difficultHowever, you should know vector's cross product, and implement it.If not, please refer http://tutorial.math.lamar.edu/Classes/CalcII/CrossProduct.aspxmethod cross() s..
-
Practice>Python>Numpy>Inner and Outerhackerrank.com 2019. 3. 13. 13:06
hackerrank.comInner and OuterProblem link : https://www.hackerrank.com/challenges/np-inner-and-outer/problemDifficulty : Easy TipLet's learn how to use numpy.inner() and numpy.outer() Solution import numpy as np A = np.array(input().split(' '), int) B = np.array(input().split(' '), int) print(np.inner(A, B)) print(np.outer(A, B))
-
Practice>Python>Numpy>Dot and Crosshackerrank.com 2019. 3. 13. 13:00
hackerrank.comDot and CrossProblem link : https://www.hackerrank.com/challenges/np-dot-and-cross/problemDifficulty : Easy TipPlease understand regarding numpy.dot() Solution import numpy as np N = int(input()) A = np.array([input().split(' ') for _ in range(N)], int) B = np.array([input().split(' ') for _ in range(N)], int) print(np.dot(A, B))