알고리즘/코드워

[python]Take the Derivative

(ㅇㅅㅎ) 2020. 5. 9. 20:34
728x90
반응형

https://www.codewars.com/kata/5963c18ecb97be020b0000a2/train/python

 

Codewars: Train your coding skills

Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential.

www.codewars.com

이 문제는 두 값을 입력받을 때 "두 수의 곲x^두 번째 값-1"를 반환하면 됩니다.

 

전체 코드

# My Code
def derive(coefficient, exponent):
    return str(coefficient * exponent) + "x^" + str(exponent - 1)
 
if __name__=='__main__':
    print(derive(78))
    print(derive(59))
 
반응형

'알고리즘 > 코드워' 카테고리의 다른 글

[python]IP Validation  (0) 2020.05.16
[python]RGB To Hex Conversion  (0) 2020.05.13
[python]Triple Trouble  (0) 2020.05.08
[python]Beginner Series #2 Clock  (0) 2020.05.07
[python]Watermelon  (0) 2020.05.06