Code War 41

[python]How do I compare numbers?

https://www.codewars.com/kata/55d8618adfda93c89600012e/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 더보기 내 코드 is를 ==으로 바꿔주면 됩니다. is는 변수가 같은 객체(Object)를 가리키면 True이지만 ==는 변수가 같은 값(Value)을 가지면 True이다. what_is함수에 42 * 42의 값을 넣으면 식이 들어가는 것이 아니라 계산된 값이 들어가..

[python]Permutations

https://www.codewars.com/kata/5254ca2719453dcc0b00027d/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 더보기 내 코드 itertools의 permutations을 이용하면 쉽게 풀 수 있다. 하지만 permutations을 사용하지 않고 푸는 것도 중요한 것 같다. # My Code import itertools def permutations(string): # 순열..

[python]Is the string uppercase?

https://www.codewars.com/kata/56cd44e1aa4ac7879200010b/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 더보기 내 코드 isupper() 함수로 문제를 풀 수 있다. # My Code def is_uppercase(inp): for i in inp: if i.islower(): return False return True def is_uppercase1_(inp): r..

[python]altERnaTIng cAsE <=> ALTerNAtiNG CaSe

https://www.codewars.com/kata/56efc695740d30f963000557/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 더보기 내 코드 # My Code def to_alternating_case(string): answer ='' for i in string: # 소문자이면 대문자로 if i.isupper(): answer += i.lower() # 대문자이면 소문자로 elif i...

[python]Is my friend cheating?

https://www.codewars.com/kata/5547cc7dcad755e480000004/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 더보기 내 코드 # My Code def removNb(n): answer = [] sum = int((n+1)*n/2) # a를 1부터 n 만큼 증가시키면서 b를 찾는다. for a in range(1, n+1): # b를 수식으로 정리하면 아래와 같다. # b =..

[python]What's a Perfect Power anyway?

https://www.codewars.com/kata/54d4c8b08776e4ad92000835/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 더보기 내 코드 # My Code import math # 에라토스테네스 체 응용 def isPP(n): # 효율적으로 코딩하기 위해서는 n의 제곱근까지만 확인 for m in range(2, int(math.sqrt(n)) + 1): # 지수함수의 역연산이 필요하므..

[python]Beginner Series#1 School Paperwork

https://www.codewars.com/kata/55f9b48403f6b87a7c0000bd/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 더보기 내 코드 n과 m이 0보다 작을 경우는 0을 return 한다. 그 이외의 경우는 n과 m의 곱한 값을 return 한다. # My Code def paperwork(n, m): return (0 if n

728x90