코드워 38

[python] Binomial Expansion

https://www.codewars.com/kata/540d0fdd3b6532e5c3000b5b/train/python Codewars - Achieve mastery through coding practice and developer mentorship A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages! www.codewars.com 이 문제는 (ax+b)^n 식을 풀어서 적는 것입니다. 예를 들어 (x+1)^2의 경우 답은 x^2+2x+1입니다. ⭐ 처음에는..

[python]Can you sum?

https://www.codewars.com/kata/638bc5d372d41880c7a99edc/train/python Codewars - Achieve mastery through coding practice and developer mentorship A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages! www.codewars.com 이 문제는 알고리즘 문제라기보다 수학 문제입니다. n을 입력받을 때 아래의 식의 답을 구하는 것입니다. 답이 클 경우 10의 9..

[python]Squash the bugs

www.codewars.com/kata/56f173a35b91399a05000cb7/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 한 문장 안에서 가장 긴 단어의 길이를 구하는 문제입니다. 이 문제를 풀기 위해서는 다음과 같은 과정이 필요합니다. 1. 문장을 단어로 나누기 → split() 2. 단어의 길이 구하기 → len() 3. 가장 긴 길이 구하기 → max() def fin..

[python]Holiday VI - Shark Pontoon

www.codewars.com/kata/57e921d8b36340f1fd000059/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 바다에서 상어에게서 도망칠 수 있을지 없을지를 판단하는 것입니다. 도망칠 수 있으면 "Alive!"를 도망칠 수 없으면 "Shark Bait!"를 반환하면 됩니다. 이 문제에서는 다음의 5가지 변수가 주어집니다. 변수 설명 sharkDistance 상어와..

[python]Exclusive "or" (xor) Logical Operator

www.codewars.com/kata/56fa3c5ce4d45d2a52001b3c/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 입력받은 두 불리언을 xor 한 값을 반환하는 것입니다. xor이란 수리 논리학에서 주어진 2개의 명제 가운데 1개만 참일 경우를 말합니다. 벤 다이어 그램으로 보면 다음과 같습니다. 더 자세한 정보는 아래의 사이트에서 확인하시면 됩니다. ko.wikip..

[python]How good are you really?

www.codewars.com/kata/5601409514fc93442500010b/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 내 점수가 반 평균보다 높은지 낮은지 판별하는 문제입니다. 반 평균보다 높을 경우 True를 반환하고 낮을 경우 False를 반환하면 됩니다. 1. sum()과 len() 사용 sum() : 리스트 요소가 모두 숫자일 경우 리스트의 합을 구할 수 있습니다..

[python]Thinkful - Number Drills: Blue and red marbles

www.codewars.com/kata/5862f663b4e9d6f12b00003b/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 사실 영어 해석이 문제인 문제입니다.(뭔가... 말이 이상하네요.) 즉, 영어 해석을 잘한다면 풀이는 어렵지 않은 문제입니다. 가방 안에 파란 구슬과 빨간 구슬이 섞여 있을 때 파란색 구슬을 꺼낼 확률을 구하는 문제입니다. 입력 값은 (가방에 넣은 파란색..

[python]No zeros for heros

www.codewars.com/kata/570a6a46455d08ff8d001002/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 입력받은 수에서 숫자의 끝자리(1의 자리 수)가 0이 되지 않도록 만드는 것입니다. 만약 입력받는 수가 0일 경우는 0을 반환하면 됩니다. 이 문제는 % 연산자와 // 연산자를 이용하거나 rstrip()을 이용하면 쉽게 풀 수 있습니다. 1. % 연산자와..

[python]N-th Power

www.codewars.com/kata/57d814e4950d8489720008db/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 양의 정수만 있는 배열과 숫자 n을 입력으로 받습니다. 입력받은 배열에서 인덱스 n번째의 거듭제곱을 반환하는 문제입니다. 만약 배열 안에 인덱스 n이 존재하지 않을 경우 -1을 반환합니다. 거듭제곱의 ** 연산자를 사용하거나 pow(x, y)를 사용할 수..

[python]Grasshopper - Grade book

www.codewars.com/kata/55cbd4ba903825f7970000f5/train/python Codewars: Achieve mastery through challenge Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 이 문제는 입력받은 점수들의 평균에 따라서 학점을 다르게 출력하는 문제입니다. 우선적으로 이 문제를 풀려면 평균을 구해야 하며 이 평균을 if문을 사용하여 다른 결과 값을 나타내야 합니다. if문을 연습할 수 있는 초보자분들에게 좋은 문제입니다. :D def get..

728x90